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

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)