Shell's advantage: You can call Linux system commands directly
Basic syntax for shell scripts:
Script name ends with. sh
The first action of the program #!/bin/bash, tell the system this is a shell script
With # as a comment
How shell scripts are executed:
Give script execution permission first, chmod;
It is called directly with an absolute or relative path (because the shell is an executable program, so it can be called directly with a path), such as:
/home/hqqq/test/t.sh
Basic features of bash:
One, Tab key file and command completion:
If there is only one match, it can be auto-complete once, and if there are more than one match, press two tab to prompt.
Second, the command alias:
Command alias query:
Alias
To set a command alias:
Alias aliases = ' Original command '
To delete an alias:
Unalias aliases
Order of command execution:
1. Executing commands with paths
2. Aliases
Internal command for 3.Bash
4. The first command found by the directory in the environment variable
The way the command line is set will only take effect temporarily, making the alias permanent for writing to the configuration file:
/user Home Directory/.BASHRC
Third, bash common shortcut keys
CTRL + C forces the current command to terminate
Ctrl+u the command before deleting or cutting the cursor
Ctrl+l Clear Screen
Ctrl+y Paste Ctrl+u Cut content
Ctrl+d exiting the current terminal
Iv. Input and output redirection
Standard input: Keyboard. File Descriptor: 0
Standard output: Monitor. File Descriptor: 1
Standard error Output: Monitor. File Descriptor: 2
Standard output redirection:
Five, multiple order execution and pipe character
Sequential execution of MULTIPLE commands:
Pipe character:
Command 1 | Command 2 #命令1的正确输出作为命令2的操作对象
Six, wildcards and other special characters
Linux notes: Shell basics and Bash's basic features