I've used /dev/null
a lot in bash programming to send unnecessary output into a black hole.
For example, this command:
$ echo 'foo bar' > /dev/null
$
Will not echo
anything. I've read that /dev/null
is an empty file used to dispose of unwanted output through redirection. But how exactly does this disposal take place? I can't imagine /dev/null
writing the content to a file and then immediately deleting that file. So what actually happens when you redirect to this file?
/dev/null
is not a real file. It is a pseudofile device that simply discards any data written to it. – Dustidustie