whatis pipe
Pipe
Also known as: |, pipeline
The | operator, which sends the standard output of one command directly into the standard input of the next.
What Is a Pipe in Linux?
Pipes are the core of the Unix philosophy: small tools that each do one thing, chained together. In ps aux | grep nginx, the output of ps never touches disk; the kernel streams it straight into grep.
A pipeline returns the exit status of its last command by default. Bash set -o pipefail makes it return the first failure instead, so a broken step earlier in the chain is not hidden.
Example
journalctl -u nginx | grep -i error | sort | uniq -c | sort -rn | head Learn more about Pipe
- I/O Redirection and Pipes Explained Every Linux command reads from standard input and writes to standard output and standard error. This guide explains those three streams and how to redirect and chain them with >, >>, <, 2>&1, pipes, and xargs.
- The xargs Command Explained: Turning Output Into Arguments xargs takes lines of input and turns them into command arguments, letting you chain find, grep, and other tools into pipelines that act on hundreds of files at once. Here is how it works and where it bites.
- tee Command Explained: Writing to a File and the Screen at Once tee splits a stream so it goes to a file and onward down the pipeline. It is also the standard way to write to a root-owned file without running your editor as root.