What is a shell?
The shell is the user interface of the system and provides an interface ( command interpreter ) for the user to interact with the kernel . It receives the command entered by the user and sends it to the kernel for execution . Plays the role of interaction between the user and the system.
The function of the shell:
- Command line explanation
- Multiple execution orders of commands
- Wildcard
- Command completion, alias mechanism, command history
- I / O heavy redirect
- pipeline
- Command substitution (` `or $() )
- shell programming language
Shell can execute -internal commands , external commands
The shell commands are divided into:
Internal (built-in) commands
Internal commands are some commands contained in the shell itself, and the code of these internal commands is an integral part of the entire shell code;
The execution of internal commands is done by the shell by executing the corresponding part of its own code .
External (external) commands
The code of the external command is stored in some binary executable files or shell scripts ;
When an external command is executed, the shell will search for the corresponding file in some directories specified in the file system , and then transfer it into the memory for execution.
command:
- The shell types supported by the system can be obtained (checked) by executing chsh -l
- Can also ls command to view these shell details
# ls –al / bin / sh
lrwxrwxrwx 1 root root 4 10月8 2017 / bin / sh -> bash
- The names of the directories searched by Shell are stored in a shell variable PATH
Directory name: separated, used in dos; separated