Pipe (|) connects two commands so that the output (stdout) of the first command becomes the input (stdin) of the second command.
Think of it like a water pipe:
Loading...Instead of water flowing through a pipe, data flows through it.
Real example
Suppose you have a file
students.txt:Loading...Without a pipe:
Loading...Output:
Loading...Now use a pipe:
Loading...What happens?
cat students.txtprints all the lines.
- The pipe
|catches that output.
head -n 2receives it as input and prints only the first 2 lines.
Output:
Loading...Another example
Loading...ls→ lists all files.
|→ sends that list to the next command.
wc -l→ counts the number of lines.
If there are 15 files:
Loading...Pipe in Linux terms
- Stdout (Standard Output) of the first command → Stdin (Standard Input) of the second command.
Loading...One-line definition for notes
Pipe (|) is a Linux operator that passes the standard output (stdout) of one command as the standard input (stdin) to another command, allowing multiple commands to work together.
.jpg?table=block&id=29d76b1d-f1a8-8072-a9bf-cc78d1c7d881&cache=v2)
