pipe
The | operator, which connects one command's standard output to the next command's standard input so they run together.
In more detail
Each command in the chain does one job, and the shell runs them together, streaming data from one to the next. Only standard output goes through the pipe; error messages still go to the terminal.
Examples
grep GET access.log | cut -d' ' -f4 | sort | uniq -cgit cat-file -p HEAD | git hash-object -t commit --stdinRelated terms
- pipefail — The bash option that makes a pipeline fail if any stage fails, instead of reporting only the last stage's status.
- tee — A command that copies its standard input both to one or more files and to its standard output.
- subshell — A child copy of the current shell, created by ( ), by command substitution and by each stage of a pipe.
- standard output and standard error — The two channels a program writes normal output (stdout) and error messages (stderr) to, plus stdin for input.
- redirection — Sending a command's output into a file instead of the terminal: > replaces the file, >> appends to the end of it.
Taught in
- Moving Around: pwd, ls, cd And Paths — Bash Scripting & Command Line Automation
- Standard Input, Output And Error — Bash Scripting & Command Line Automation
- Redirection: Truncate, Append, Both Streams — Bash Scripting & Command Line Automation
- Pipelines, tee And Process Substitution — Bash Scripting & Command Line Automation
- Finding Lines: grep And Regular Expressions — Bash Scripting & Command Line Automation
- Reshaping Text: cut, sort, uniq, tr, sed, awk — Bash Scripting & Command Line Automation
- Command Substitution And Subshells — Bash Scripting & Command Line Automation
- Arithmetic: Double Parentheses, let And bc — Bash Scripting & Command Line Automation
- Exit Codes, And What Success Means — Bash Scripting & Command Line Automation
- Conditionals: test, Brackets, Double Brackets, case — Bash Scripting & Command Line Automation
- Script Input And Output: read, Heredocs, printf — Bash Scripting & Command Line Automation
- set -e, set -u And pipefail: Promises And Traps — Bash Scripting & Command Line Automation
- Style That Prevents Bugs — Bash Scripting & Command Line Automation
- find And xargs — Bash Scripting & Command Line Automation
- Scheduling, Monitoring And A Script That Reports — Bash Scripting & Command Line Automation
- Why Version Control, And Why Git Won — Advanced Git Internals & Distributed Workflows
- What A Commit Really Is — Advanced Git Internals & Distributed Workflows
- Conventional Commits — Advanced Git Internals & Distributed Workflows
- Jinja Templates: One File, A Different Text Per Host — RHCE in Ansible (EX294): Automate Red Hat Systems