Linux command execution process
1. The determination as to whether the user an absolute or relative path input command (e.g., / bin / ls), and if so executed directly
2.Linux command system checks the user input is "alias command."
I.e., the name of a custom command to replace the original name of the command (format: alias = alias command)
To cancel a command aliases, use unalias, format: unalias alias
3.Bash interpreter determines a user input command is an internal or external command internal command internal command interpreter are executed directly; while most of the time the user input is an external command, the command will be referred Step 4 continue processing. You can use "type the command name" to determine the order entered by the user is an internal command or external command.
4. The system looks in more user input commands file paths, these paths are defined variable called PATH, it can simply be understood as "the interpreter little helper", is to tell the Bash shell command to be executed may be stored position, then the interpreter will be good Bash one by one to find the value of the variable .PATH is composed of a plurality of paths in these locations, the path between each value separated by colons, add and delete operations on such paths will affect Bash interpreter to look for Linux commands.
Note:
1. Why can not the current directory (.) To the PATH variable in it?
A: (.) Although you can add the current directory to the PATH variable, which in some cases allows users without having to enter the path of the command. However, if a hacker to store the ls or cd command with the same name as the Trojan files commonly used public directory / tmp, the user happened to execute these commands in the public directory, then it is very likely in the move.
2. Upon receipt of any of a Linux system will check the PATH variable suspicious directory before executing the command
Linux system, the most important of the 10 environmental variables
Variable name |
effect |
HOME |
The user's home directory (home directory) |
SHELL |
Users use the shell interpreter name |
HISTSIZE |
History command output number of records |
HISTFILESIZE |
Saved command number of records |
|
Save path of the message |
JUST |
System language, language name |
RANDOM |
Generates a random number |
PS1 |
BASH interpreter prompt |
PATH |
Path definition interpreter search user executing the command |
EDITOR |
The user's default text editor |
Compositional variables: variable name with a fixed variable value set by the user or the system composed of two parts
Enhance global variables command: export