DELAPARRA
Index
Color
NL
Category: CLI commands

| (pipe)

Explained by Updated

What is | (pipe)?

| (pipe): Pipe — Send the output of one command as the input to the next. The pipe | connects commands. The output of the command on the left becomes the input of the command on the right. cat access.log | grep 404 | wc -l counts how many requests returned a 404.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about | (pipe)

How is | (pipe) used in practice?

This is the core idea of the Unix command line. Small tools each do one job well, and you combine them for the task at hand. You do not need a special program to count errors in a log; you chain three general ones.

What should you keep in mind with | (pipe)?

Two things are worth knowing. A pipe only passes normal output, not error messages, unless you add 2>&1. And in a script, a pipeline normally reports success if the last command succeeded, even when an earlier one failed. Add set -o pipefail at the top of Bash scripts so a failure anywhere in the chain is noticed.

At a glance

CategoryCLI commands
Explained by
Updated

More CLI commands terms

All terms starting with a number or symbol

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.