Introduction and use of shell commands
1. What is shell?
In computer science, Shell, commonly known as shell, is a software (command parser) that provides user interfaces ). It is similar to command.com in DOS. It receives user commands and calls corresponding applications.
2. Shell is divided into two categories
Class 1: graphical shell (graphical user interface shell)
For example, the most widely used Windows Explorer (Microsoft's Windows Production System) and the well-known Linux Shell, including X Window manger (blackbox and fluxbox ), and more powerful CDE, gnome, Kde, xfce.
Class 2: command line interface shell (CLI shell)
For example:
Bash/SH/KSh/CSH (Unix/Linux)
Command. com (MS-DOS System)
Cmd.exe/command prompt character (Windows NT System)
Windows powershell (Windows NT System Supporting. NET Framework Technology)
3. Two shell Modes
Interactive Shell and non-interactive shell
In interactive mode, shell waits for your input and runs the command you submit. This mode is called interactive because shell interacts with users. This mode is also very familiar to most users: logon, command execution, and logout. When you sign back, shell is terminated.
Shell can also run in another mode: non-interactive mode. In this mode, shell does not interact with you, But reads commands stored in files and runs them. When it reads the end of the file, shell is terminated.
Shows the layer of shell in a computer:
4. Common shell types
The default port of the Bourne shell Linux is the Bourne again shell, which is an extension of the Bourne shell, bash for short.
C Shell
Korn Shell
5. Shell Command Format
A. Command example
Command example:
Qiaoqiao @ Ubuntu :~ /Download $
Meanings of related fields:
Qiaoqiao: User Name
@: This symbol is an interval symbol.
Ubuntu: Host Name
:~ /Download: This indicates that the command is stored in the download directory.
$: Common User
#: Super Administrator
B. Command Format
Command Format:
Command-options argument
For example, reset the password sudo passwd root.
Meanings of related parameters:
Command
-: Indicates an option.
Options: Options in the command
Arguments: parameters in the options
For commands, there can be no or more options and parameters.
6. Shell Command shortcut
Shows the shell command shortcut:
7. Special shell operations
Auto-complete function ESC or tab
Command history
8. Shell Command definition alias
(1) command alias, using the keyword alias. For example:
After alias Adam = "ls -- color = auto" is executed, Adam will have the LS function.
(2) view the echo variable, for example, Echo $ path.
(3) view the command. Go to the "bin" folder and click "ls" to view the system command.
(4) return to the current directory Cd ~
Run./In the current directory ./
(5) view the environment variable env
9. Shell file type conversion
Shell configuration file/etc/shells
The default shell command used by the system: Echo $ Shell
Shell Command Used by the current user after conversion: Echo $0
History File. bash_history
10. Shell Input and Output redirection
Value description, 0: Standard Input 1: Standard Output 2: Error output
Description of the redirection symbol:
<To change the read data (stdin) so that it can be read from the specified file
> To change the output (stdout, stderr) to output it to the specified file.
0 is the default value of <, so <and 0 <are the same; similarly> and> 1 are the same.
For example, write the file statistics in the home folder to the CMD file.
Ls> CMD is equivalent to LS 1> cmd
Shows the code and effect of the redirection operation example:
11. Common shell commands and help
Shell Command help
Help simple command help
-- Help detailed Command help
Man authoritative detailed Command help
Common shell commands
Calculator BC
Calendar Cal
Date
Restart and shutdown now
Shutdown-H + 30 "the computer is going to shutdown after the file download completed! "
Reference:
1. Go to Ubuntu. Linux. Basic video tutorial in yadong.
2. Baidu encyclopedia shell entry