The bit bucket
/dev/null is a special file that throws away everything written to it and returns 0 bytes when read. It is the canonical way to silence noise in Unix.
Common uses
cmd 2>/dev/null— kill error spam.cmd >/dev/null 2>&1— kill all output.cmd </dev/null— feed an empty stdin (useful for background jobs that read).: > fileorcat /dev/null > file— truncate a file to zero.
The truthy version: /dev/zero
/dev/zero reads as an infinite stream of null bytes. dd if=/dev/zero of=blob bs=1M count=10 creates a 10 MB file of zeros — useful for filesystem tests, swap files, or generating test data. Sibling: /dev/random (cryptographic randomness, slow) and /dev/urandom (also random, fast, fine for almost everything).
Don't accidentally redirect input
cmd > /dev/null hides output. cmd < /dev/null feeds empty stdin. Mix them up and your script silently does nothing because you fed it an empty input stream.
Silencing bytes does not silence failure
Redirecting output to /dev/null leaves the command's exit status intact. Handle that status explicitly instead of treating invisible output as unimportant work.
Discard diagnostics narrowly
Sending both streams to the null device removes the evidence needed to recover a scheduled task. Prefer bounded logs and discard only noise you can name.
The null device is not an empty file
An empty regular file has a directory entry, permissions, timestamps, and persistent storage. /dev/null is a device endpoint that discards writes and returns immediate EOF on reads; do not use the two as interchangeable state.