/dev/null
From Wikipedia, the free encyclopedia
This article or section includes a list of references or external links, but its sources remain unclear because it lacks in-text citations. You can improve this article by introducing more precise citations. |
In Unix-like operating systems, /dev/null or the null device is a special file that discards all data written to it (but reports that the write operation succeeded), and provides no data to any process that reads from it (it returns EOF). In Unix programmer jargon, it may also be called the bit bucket or black hole.
The null device is typically used for disposing of unwanted output streams of a process, or as a convenient empty file for input streams. This is usually done by redirection.
This entity is a common inspiration for technical jargon expressions and metaphors by Unix programmers, e.g. "please send complaints to /dev/null," "my mail got archived in /dev/null," and "redirect to /dev/null," being jocular ways of saying, respectively: "don't bother to send any complaints," "my mail got deleted," and "go to hell." A famous advertisement for the Titanium PowerBook G4 read The Titanium Powerbook G4 Sends other UNIX boxes to /dev/null.
The null device is also a favorite subject of technical jokes, such as warning users that the system's /dev/null is already 98% full. The April Fool's, 1995 issue of the German magazine c't reported on an enhanced /dev/null chip that would efficiently dispose of the incoming data by converting it to a flicker on an internal glowing LED.
/dev/null is a special file, not a directory, so one cannot move files into it with the Unix mv command. The rm command is the proper way to delete files in Unix.
The equivalent device in CP/M (and later DOS and Windows) is called NUL: or just NUL (for example, one may hide output by directing it to NUL, e.g. PAUSE>NUL, which waits for the user to press any key without printing anything to the screen). Under classic Amiga operating systems, the device's name is NIL:. In Windows NT and its successors, it is named \Device\Null internally, though, the DOS NUL is a symbolic link to it. Similarly, in OpenVMS the device is named NL:.