& Lt; built-in commands and external commands in linux & gt;

Source: Internet
Author: User
Tags builtin

<Built-in commands and external commands in linux>

Built-in and external commands in Linux

1. linux commands can be divided into internal commands and external commands:

Internal commands are transferred to the memory at system startup, Which is resident memory, so the execution efficiency is high.

External commands are the software functions of the system. Users can read the memory from the hard disk only when needed.

Enable allows you to view internal commands and determine whether an internal command is used.

[Root @ localhost ~] # Enable ls // determine if ls is a built-in command
-Bash: enable: ls: not a shell builtin // It is not an internal command
[Root @ localhost ~] # Enable pwd // pwd is an internal command
[Root @ localhost ~] # Enable-n // disable the use of pwd Internal Command-n

[Root @ localhost ~] # Enable-a | grep pwd // check whether it is disabled
Enable-n pwd
[Root @ localhost ~] # Enable pwd // enable the built-in pwd command
[Root @ localhost ~] # Enable-a | grep pwd
Enable pwd

When you enter Internal commands, the system calls the system at a fast speed. Instead of a built-in command, the system will read the environment variable file. bash_profile and/etc/profile to find the PATH.

Next, let's mention the call of the command. Some Historical commands will exist in the hash table after they are used. When you enter the command again, it will be called like this.

The calling of hash --> built-in command --> PATH command is actually such a process.

[Root @ localhost ~] # Pwd
/Root
[Root @ localhost ~] # Ls
Anaconda-ks.cfg install. log install. log. syslog
[Root @ localhost ~] # Hash-l // display the hash table
Builtin hash-p/bin/cat
Builtin hash-p/bin/ls

We can see from the hash table. The hash table does not store built-in commands.

 

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.