What does vertical bar mean in linux

WBOY
Release: 2022-03-24 09:21:05
Original
7977 people have browsed it

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".

What does vertical bar mean in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What does the vertical bar mean in Linux

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
Copy after login

The example is as follows:

$ls -s|sort -nr
Copy after login

-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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template