Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "|" mean in a terminal command line? [closed]

Sorry for posting it here, but Google does a very bad job when searching for symbols.

What does the "|" mean in:

"some string" | someexecutable.py 
like image 759
frazman Avatar asked Sep 13 '12 06:09

frazman


2 Answers

It is the pipe symbol. It separates two programs on a command line (see Pipelines in the bash manual), and the standard output of the first program (on the LHS of the pipe) is connected to the standard input of the second program (on the RHS of the pipe).

For example:

who | wc -l 

gives you a count of the number of people or sessions connected to your computer (plus one for the header line from who). To discount the header line:

who | sed 1d | wc -l 

The input to sed comes from who, and the output of sed goes to wc.

The underlying system call is pipe(2) used in conjunction with fork(), dup2() and the exec*() system calls.

like image 190
Jonathan Leffler Avatar answered Sep 22 '22 02:09

Jonathan Leffler


It's called pipe. It gives the stdout of the first command ("some string") as the stdin to the second command (someexecutable.py).

like image 29
P.P Avatar answered Sep 25 '22 02:09

P.P