How to distinguish internal commands from external commands in Linux?

  The built-in commands are loaded into the memory when the system starts, and are resident in the memory, so the execution efficiency is high. The external command is a software function of the system, and the user only reads it into the memory from the hard disk when needed.

  external command

  External commands, also known as file system commands, are programs outside of the bash shell and not part of the shell. External commands are generally located in /bin, /usr/bin, /sbin, or /usr/sbin. External commands are part of the utility program in the Linux system. Because the functions of the utility program are usually relatively powerful, the amount of programs it contains will also be large. When it is called into memory.

  Usually the entity of the external command is not included in the shell, but its command execution process is controlled by the shell program. The shell program manages the path search, loading and storage of external commands, and controls the execution of commands. External commands are installed outside of bash, usually placed in /bin, /usr/bin, /sbin, /usr/bin...etc. You can use the "echo $PATH" command to view the storage path of external commands, such as: ls, vi, etc.

  built-in commands

  The internal command is actually a part of the shell program, which contains some relatively simple Linux system commands. These commands are recognized by the shell program and run inside the shell program. Usually, the shell is loaded and resides when the Linux system is loaded and running. in system memory.

  The internal command is written in the bash source code, and its execution speed is faster than that of the external command, because the shell does not need to create a child process to parse the internal command. For example: exit, history, cd,

Guess you like

Origin blog.csdn.net/taoxicun/article/details/131770047