/* Configure /*-----------------------------------------------------------------------------------------------
@ Blackeye poet <www. chenwei. ws>
Optional -----------------------------------------------------------------------------------------------*/
1. Multiple commands are executed sequentially.
Semicolon (;)
Logic and (&&)
Logic or (|)
Semicolon:
Ls;Date;CD/user;PWD
Execution sequence: commands are executed sequentially. There is no relation between commands and they do not affect each other.
Purpose: connect multiple commands to simplify operations
Example:
Dd If = input file of = output file BS = Bytes Count = count (used to copy a disk)
(Date; dd If =/dev/Zero of =/home/testfile BS = 1 k count = 10000; Date) # Count the execution time
Option:
If = input file specifies source file or Source Device
Of = specifies the target file or target device for the output device.
BS = the number of bytes specifies the number of bytes input/output at a time, that is, these bytes are considered as a data block.
Count = number of data blocks specified for Input/Output
Logic and:
Ls & Echo Yes
Execution sequence: The second command is executed only when the first command is successfully executed.
Purpose: The command has a logical relationship and must have a certain execution order.
Logic or:
Ls | echo No
Execution sequence: the first is successfully executed, the second is not executed; the first is not executed correctly, and the second is executed
Purpose: Determine whether the previous command is correctly executed
Use of logic and logic or combination:
Command & Echo Yes | echo No# Use this method to determine whether the command is executed
2. pipeline operator:
Command 1 | command 2# Use the result of command 1 as the operation object of command 2
Example:
Ls-L | more # display the correct command execution result on multiple screens
Grep [Option] 'search content' file name# Search for matching strings in the file
Option:
-I case-insensitive
-N: Output row number
-V reverse lookup
-- Color = the keywords searched by auto are displayed in color.
(View the number of remote connections on the current computer)