The pipe

|

Pass the output of one command to the input of another

How it works

| (the pipe) connects commands: what the left one prints becomes the input of the right one. cat app.log | grep ERROR prints the log and keeps only the error lines straight away.

A chain can be as long as you like: history | grep git | tail -5 shows your last five git commands. That is how simple commands add up to the result you need: each does one job, and the pipe links them.

Syntax

<command> | <command>
<command> | <command> | <command>

Examples

Related commands

Practise · All commands