Home > Article > Operation and Maintenance > What does vertical bar mean in linux
In Linux, the vertical bar means the pipe symbol. The function of this symbol is to connect two commands and use the output of the first command as the input of the second command. The syntax is "command 1 | command 2".
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
The vertical bar '|' is used as a pipe character in Linux, and the output of the command before '|' is used as the input after '|'.
Its function is:
Connect two commands and use the output of the first command as the input of the second command.
command 1 | command 2
The example is as follows:
$ls -s|sort -nr
-s is file size, -n is numeric-sort, -r is reverse, reverse
This command lists the documents (including size) in the current directory and sends the output to sort command as input, the sort command sorts the output of ls in numerically descending order.
$ls -s|sort -n
Output in order from small to large.
Of course, multiple operations can be performed. For example, the following function is to first remove pure numbers, then use sed to replace vertical bars (not pipe symbols here) with spaces, then take out the results, sort them, and then process the results. The selection display
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of What does vertical bar mean in linux. For more information, please follow other related articles on the PHP Chinese website!