Shell commands are usually divided into two categories:
Built-in commands (man Builtins)
External command
The difference between the two is analyzed below.
Built-in commands:
Internal commands are built into the shell. The internal command executes very quickly when the shell command is executed. This is because no other process has been created because of the execution of this command. For example, when we execute the "CD" command, no process is created. Simply change the current directory during execution.
External command:
External commands are not built into the shell. These executable external commands are stored in a separate file. When an external command is executed, a new process is created at the same time that the command is executed.
The type command lets you determine whether a command is built-in or external.
Should we use external commands or internal commands or what kind of command is better? There is no point in a problem like this. Because in most cases we just have to reach our goal, regardless of whether we are using internal or external commands.
The biggest difference between internal commands and external commands is performance. Internal commands are much faster than external command execution because they are built in the shell without having to create redundant processes. As a result, executing scripts that contain many external commands can compromise the performance of the script, as is the case with larger scripts.
We are not always faced with the choice of internal commands and external commands. But in the course of our scripting connection, as long as we look carefully, we can see that there are places where we can avoid using external commands.
This article is from the "Yunfei Dance" blog, please make sure to keep this source http://wuyunncu.blog.51cto.com/5978596/1709575
The difference between a shell's built-in command and an external command