Linux system command parsing

  
                

For Linux systems, users must be impressed with its powerful commands, but many Linux users are not familiar with the commands in the Linux system. Let's take a look at the Linux system with Xiaobian. Let's order.

Linux commands into internal commands and external commands:

internal command when the system starts it into memory, the memory is permanent, so the implementation of high efficiency.

External commands are software features of the system that are read into the memory from the hard disk when needed.

type can be used to determine whether a command is a built-in command

type: usage: type [-afptP] name [name . . . ]

[root@linuxeye ~]# type type

type is a shell builtin

[root@linuxeye ~]# type -p type

[root@linuxeye ~]# type -t type

builtin

[root@linuxeye ~]# type type

type is a shell builtin

[root@linuxeye ~]# type -t type

builtin

[root@linuxeye ~]# type pwd

pwd is a shell builtin

[root@linuxeye ~]# type whiptail

whiptail is /usr/bin/whiptail

[root@linuxeye ~]# type -t whiptail

file

enable can view internal commands as well as internal commands

[root@linuxeye ~]# enable -a #View internal commands

[root@linuxeye ~] # enable whiptail #非内命令

-bash: enable: whiptail: not a shell builtin

[root@linuxeye ~]# enable pwd # is an internal command

internal When commanding user input Rate system calls faster, not built-in command, the system will read the environment variable file .bash_profile, /etc /profile to look for the PATH.

Then, after mentioning the call of the command, some historical commands will be stored in the hash table after they are used. When you enter the command again, its call will be such a process.

hash——"The built-in command ——" The call to the PATH command should actually be such a process.

[root@linuxeye ~]# type pwd

pwd is a shell builtin

[root@linuxeye ~]# type cat

cat is /Usr/bin/cat

[root@linuxeye ~]# ls linuxeye*

linuxeye.pem linuxeye.txt

[root@linuxeye ~]# cat linuxeye.txt

linuxeye

[root@linuxeye ~]# hash -l #display hash table

builtin hash -p /usr/bin/cat cat

Builtin hash -p /usr/bin/ls ls

[root@linuxeye ~]# type cat

cat is hashed (/usr/bin/cat)

[ Root@linuxeye ~]# hash -r #Clear hash table

[root@linuxeye ~]# type cat

cat is /usr/bin/cat

From above The operation can be seen. The hash table does not store system built-in commands.

This is the internal and external commands in the Linux system, not familiar with Linux commands, or interested users to take a look.

Copyright © Windows knowledge All Rights Reserved