The shell is the shell of the operating system, a command interface for users to use the operating system, and a bridge between the user and the operating system kernel.
Shell is commonly known as shell. Refers to the software that provides the user interface (command parser).
As a command language, it interactively interprets and executes commands entered by the user, or automatically interprets and executes a predetermined sequence of commands.
As a programming language, it defines variables and parameters, and provides many control structures in higher-order languages, including loops and branches.
Shell's main functions:
(1) Accept commands from the keyboard
(2) Check the correctness of the command
(3) An error message is given when the command is incorrect
(4) The command is correct to use the appropriate system invoke command (generating process)
(5) command execution complete, give the result of command execution
Linux makes a file of this programming language known as shell script or shell scripts
The shell script is interpreted as execution, not compiled.
The script consists of ASCII text that is read and executed by the shell command interpreter.
When executing a shell script, the command interpreter reads all ASCII text sequentially, one at a time, and executes each statement from beginning to end.
The essence of shell programming is the sequential automatic execution of a series of commands.
-
| Command |
Description |
Command |
Description |
Command |
Description |
Command |
Description |
Command |
Description |
| Pwd |
Show current directory |
|
|
|
|
|
|
|
|
passwd
|
To modify a user's password
|
|
|
|
|
|
|
|
|
| Ls |
List content in a directory
|
|
|
|
|
|
|
|
|
| Cd |
Change the current working directory |
|
|
|
|
|
|
|
|
| * |
Match any character of any length |
|
|
|
|
|
|
|
|
| ? |
Match any one character |
|
|
|
|
|
|
|
|
| [] |
Any character that belongs to a character group |
|
|
|
|
|
|
|
|
| Cat |
Display the entire contents of the output file at once |
|
|
|
|
|
|
|
|
| File |
Display the type of file |
|
|
|
|
|
|
|
|
| More |
Split-screen display of the contents of a file |
|
|
|
|
|
|
|
|
| Clear |
Clear screen, prompt back to top left of screen |
|
|
|
|
|
|
|
|
Advantages of Shell scripting:
(1) Complete the goal at once
(2) Do not type a series of commands repeatedly
(3) Simplify the operation of the user
After the user has successfully logged into the system, the system generates a specific shell (which is the user's first process) responsible for interpreting the execution User's command or shell script.
At the system prompt, the user types a command or shell script name to execute the specified command or shell script. If the user wishes to terminate the execution of a command or script, it can be done directly by CTRL + C.
If the user finishes the job and wants to eject the system, you can press Ctrl+d or use the command logout or exit.