What categories are Linux instructions divided into?

青灯夜游
Release: 2022-05-13 17:27:17
Original
4931 people have browsed it

Linux commands can be divided into 2 categories: 1. Internal commands, which refer to commands integrated within the shell. Such commands do not require manual installation and automatically run in the memory after booting, such as cd, type, echo, time, true, etc.; 2. External commands refer to command tool packages installed through external media, such as yum, rpm, etc.

What categories are Linux instructions divided into?

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

Linux is a text-driven operating system. The advantage is that it can perform command interface operations. Compared with the graphical interface, the command interface can save a lot of physical memory space and avoid the dense lists that appear in the graphical interface; at the same time, the command interface can complete quite complex operations. Of course, we can also understand the graphical interface as a command line graphical computing shell.

The important role of the Linux command line

Compared with the graphical interface, the Linux command line is the real core of the Linux system. Using the command line can To perform various configurations on the system, you must have an in-depth understanding of the Linux command line to be proficient and successfully manage the Linux operating system. The command line under Linux helps beginners understand the operation of the system and the various devices of the computer. For example: central processing unit, memory, disk drive, various input and output devices, and user files all run under Linux system management commands. It can be said that the Linux command line plays a core role in the operation of the entire system and the coordination between devices and files.

Although the trend of personal computers has shifted from the command line to the graphical interface in recent years, and users are also keen on graphical interface applications, the Linux command line is still the core application in server applications and high-level applications. This depends on the better stability and security of operations under the character interface.

To sum up, whether you are a Linux beginner or an authentic Linux veteran, the Linux command line is an indispensable system management tool. What needs to be remembered is that the command line is not just a command, it is a tool, and it also needs to be installed.

Classification of commands (instructions)

Linux commands are divided into two categories, specifically internal commands and external commands

  • Internal commands: Refers to the commands integrated inside the shell. Such commands do not require manual installation. They will automatically run in the memory after booting. Use the command help to view Details of all internal commands such as cd, type, echo, time, true, etc.

  • External commands: refers to the command tool package installed through external media, such as through yum, rpm, etc. Installation, the specific installation path is under $PATH.

Note: All internal commands exist in external commands, but some commands are integrated in the shell just to increase the priority.

View: type to view command classification, internal commands display shell related information, external commands display $PATH path

[root@localhost ~]# type time
time is a shell keyword
[root@localhost ~]# type date
date is /bin/date
Copy after login

Internal commands and external The generation and difference of commands

  • The shell of CentOs7 is bash; when using Linux, some commands are used more frequently. It would be wasteful to always read data from the hard disk. takes up time and resources. Therefore, bash integrates these frequently used commands into the shell to speed up calling them, and they are called built-in commands.

  • So the built-in commands are backups in the shell to speed up external command calls. That is, every built-in command exists in the external command (on the hard disk).

The difference between the two:

  • The internal commands are transferred into the memory when the system starts and are resident in the memory, so the execution efficiency is high.

  • External commands are software functions of the system, which are read from the hard disk into the memory when the user needs them.

Command execution sequence

Single command execution sequence

alias ->shell>hash>PATH

Multiple command execution sequence

Linux multi-command sequential execution connector (; || && |) When we need to execute multiple commands at once When executing a command, the commands need to be connected with connectors. Different connectors have different effects. Below we summarize and differentiate.

(1) ;

Semicolon, a connector without any logical relationship. When multiple commands are connected with semicolons, the successful execution of each command has no impact on each other and will be executed one by one.

(2) ||

逻辑或,当用此连接符连接多个命令时,前面的命令执行成功,则后面的命令不会执行。前面的命令执行失败,后面的命令才会执行。

(3) &&

逻辑与,当用此连接符连接多个命令时,前面的命令执行成功,才会执行后面的命令,前面的命令执行失败,后面的命令不会执行,与 || 正好相反。

(4) |

管道符,当用此连接符连接多个命令时,前面命令执行的正确输出,会交给后面的命令继续处理。若前面的命令执行失败,则会报错,若后面的命令无法处理前面命令的输出,也会报错。

ls | grep *.txt
Copy after login

命令优先级

alias>shell内建>hash>外部路径

相关推荐:《Linux视频教程

The above is the detailed content of What categories are Linux instructions divided into?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template