/dev/null
A special file that throws away anything written to it and reads as empty.
In more detail
Redirect output there when you only care about a command's exit status, as in grep -q or cmd > /dev/null 2>&1. Reading from it gives an immediate end of file, which is a quick way to give a command empty input.
Related terms
- redirection — Sending a command's output into a file instead of the terminal: > replaces the file, >> appends to the end of it.
- standard output and standard error — The two channels a program writes normal output (stdout) and error messages (stderr) to, plus stdin for input.
Taught in
- Redirection: Truncate, Append, Both Streams — Bash Scripting & Command Line Automation
- Pipelines, tee And Process Substitution — Bash Scripting & Command Line Automation
- Mock Exam, Part 2: Real Machines And The Patterns That Fail — RHCE in Ansible (EX294): Automate Red Hat Systems