The difference between a shell's built-in command and an external command

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.