I. Review of BASIC commands
Date//day and time displayed
WHO//view all users logged in to the system
echo//Display the input content
File Operation class
LS//List file list
CAT//Display file contents
Number of words in WC//statistics file
CP//Copy files
MV//File renaming
RM//Delete Files
Directory Operation class
PWD//show Current working directory
CD//change current working directory
mkdir//Create a directory
ln//Link file
Ln-s source file Destination file//link source file to destination file
RmDir//Delete directory
Character matching
*//Match 0 or more characters
? Match any one character
[ABC]//Match a single A or B or C
[0-9]//Match one character from 0 to 9, the ordinal of the first character of the specified range must be less than the next character
Example:
[a-np-z]*//matches a file name that starts with any letter from a-Z other than O
! Non -
Example:
[!a-z]//match any character except lowercase letters A to Z
*[!o]//matches any file name that does not end with a lowercase letter O
LS [a-z]*[0-9]//List of filenames that begin with a lowercase letter and end with a number
Standard input, Output
In the case of WHO, the WHO command writes a list of users logged into the system to a standard output device.
Input and output redirection
>//output redirect, overwrite existing content
>>//Append output redirection, do not overwrite existing content
Multiple files can be connected with cat (catenate)//After multiple files
Such as:
Cat a B >> c//Append the contents of A and B files to the C file
> File//Create an empty document named files with a length of 0 characters
Wc-l A//calculate the number of rows in a file
Pipeline
| Pipe character
W.H.O. | WC-L//The output of the WHO command is fed back to wc-l as input
Filter filters
Refers to the acceptance of input from the standard input, the input is processed, the results are written to the standard output of any program, such as SORT,WC, but LS does not count;
Standard error
2>//Standard error redirection
; Delimited commands, such as Date;pwd
&//For the back of the command, indicating background execution
PS//Display system running process information
Second, what is the shell?
Init->getty->login->sh
If a particular program is to be executed, the shell will search the disk and find the specified program, and when found, the shell requests the kernel to initialize the program, and then the shell goes to "sleep" until the program finishes executing.
Program Name parameter table
Shell role:
implementation procedures;
Interpreting programming languages;
Environmental control;
Pipe line Connection;
I/O redirection;
Variable and file name substitution;
The shell determines the starting and ending position of the program name and the starting and ending position of the parameter table by a specific character, with empty characters, tabs, and line Terminators (collectively, the whitespace characters);
The shell automatically ignores whitespace characters;
Unix Shell Programming Notes series (i)