# Null device

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Null_device
> Markdown URL: https://mediated.wiki/source/Null_device.md
> Source: https://en.wikipedia.org/wiki/Null_device
> Source revision: 1343782103
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Device file that discards all data written to it}}
{{For|the electropop band|Null Device}}
{{Confuse|/dev/zero}}
{{Use dmy dates|date=February 2020|cs1-dates=y}}

In some [operating system](/source/operating_system)s, the '''null device''' is a [device file](/source/device_file) that discards all data written to it but reports that the write operation succeeded. This device is called <code>/dev/null</code> on [Unix](/source/Unix) and [Unix-like](/source/Unix-like) systems, <code>NUL:</code> (see [TOPS-20](/source/TOPS-20)) or <code>NUL</code> on [CP/M](/source/CP%2FM) and [DOS](/source/DOS) (internally <code>\DEV\NUL</code>), <code>nul</code> on [OS/2](/source/OS%2F2) and newer [Windows](/source/Windows) systems<ref>{{Cite web|url=https://support.microsoft.com/en-us/help/110930/redirecting-error-messages-from-command-prompt-stderr-stdout|title=Redirecting Error Messages from Command Prompt: STDERR/STDOUT|website=support.microsoft.com|access-date=2020-03-06}}</ref> (internally <code>\Device\Null</code> on [Windows NT](/source/Windows_NT)), <code>NIL:</code> on [Amiga](/source/Amiga) operating systems,<ref>{{cite book |author=Commodore-Amiga, Inc. |title=The AmigaDOS Manual |date=1986 |publisher=Bantam Books |isbn=0-553-34294-0 |page=12 |url=https://archive.org/details/TheAmigaDOSUsersManual3In1Manual/page/n17/mode/2up }}</ref> and <code>NL:</code> on [OpenVMS](/source/OpenVMS).<ref>{{Cite web|url=http://h30266.www3.hpe.com/odl/vax/opsys/vmsos73/vmsos73/5841/5841pro_064.html|title=OpenVMS Programming Concepts Manual|website=h30266.www3.hpe.com|access-date=2020-03-06|archive-date=2020-07-02 |archive-url=https://web.archive.org/web/20200702065120/http://h30266.www3.hpe.com/odl/vax/opsys/vmsos73/vmsos73/5841/5841pro_064.html|url-status=dead}}</ref> In [Windows Powershell](/source/Windows_Powershell), the equivalent is <code>$null</code>.<ref>{{Cite web|url=https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables|title=about_Automatic_Variables - PowerShell|last=SteveL-MSFT|website=docs.microsoft.com|language=en-us|access-date=2020-03-06}}</ref> It provides no data to any [process](/source/process_(computing)) that reads from it, yielding [EOF](/source/end-of-file) immediately.<ref name="uxman">{{cite web|url=http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap10.html |title=Single Unix Specification Section 10.1: Directory Structure and Files |publisher=The Open Group |access-date=2012-11-29}}</ref> In IBM operating systems  [DOS/360 and successors](/source/DOS%2F360_and_successors){{efn|The most recent being [z/VSE](/source/z%2FVSE).}} and also in [OS/360 and successors](/source/OS%2F360_and_successors){{efn|The most recent being [z/OS](/source/z%2FOS).}} such files would be assigned in [JCL](/source/job_control_language) to <code>DD DUMMY</code>.

In programmer jargon, especially Unix jargon, it may also be called the [bit bucket](/source/bit_bucket)<ref>{{cite web|title=bit bucket|url=http://catb.org/esr/jargon/html/B/bit-bucket.html|work=Jargon File|access-date=2013-12-27}}</ref> or [black hole](/source/Black_hole_(networking)).

==History==
{{mono|/dev/null}} is described as an empty regular file in [Version 4 Unix](/source/Version_4_Unix).<ref>{{cite book |last1=Thompson |first1=K. |last2=Ritchie |first2=D. M. |author-link1=Ken Thompson |author-link2=Dennis Ritchie |date=November 1973 |title=UNIX Programmer's Manual, Fourth Edition |url=http://ftp.okass.net/pub/mirror/minnie.tuhs.org/Distributions/Research/Dennis_v4/v4man.tar.gz |publisher=Bell Telephone Laboratories, Inc. |no-pp=yes |page=sh (I) (./man1/sh.1)}} [//minnie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man1/sh.1 Online at TUHS.]</ref>

The [Version 5 Unix](/source/Version_5_Unix) manual describes a {{mono|/dev/null}} device with modern semantics.<ref>{{cite book |last1=Thompson |first1=K. |last2=Ritchie |first2=D. M. |author-link1=Ken Thompson |author-link2=Dennis Ritchie |date=June 1974 |title=UNIX Programmer's Manual, Fifth Edition |url=http://ftp.okass.net/pub/mirror/minnie.tuhs.org/Distributions/Research/Dennis_v5/v5man.pdf#page=218 |publisher=Bell Telephone Laboratories, Incorporated |no-pp=yes |page=mem (IV)}}</ref>

==Usage==
The null device is typically used for disposing of unwanted output [stream](/source/stream_(computing))s of a process, or as a convenient empty [file](/source/computer_file) for input streams. This is usually done by [redirection](/source/Redirection_(computing)). For example, <code>tar -c -f /dev/null "example directory"</code> can be used to dry-run the [TAR file archiving utility](/source/tar_(computing)) to see if any errors would occur but without writing any file.

The <code>/dev/null</code> device is a [special file](/source/Device_file), not a [directory](/source/directory_(file_systems)), so one cannot move a whole file or directory into it with the Unix <code>[mv](/source/mv_(Unix))</code> command.

Unix shell command <code>[cat](/source/cat_(command)) /dev/null</code> would do nothing, equivalent to <code>true</code> or <code>:</code> command.

== References in computer culture ==
This entity is a common inspiration for technical [jargon](/source/jargon) expressions and [metaphor](/source/metaphor)s by Unix programmers, e.g. "please send complaints to <code>/dev/null</code>", "my mail got archived in <code>/dev/null</code>", and "redirect to <code>/dev/null</code>"—being jocular ways of saying, respectively: "don't bother sending complaints", "my mail was deleted", and "go away". The [iPhone Dev Team](/source/iPhone_Dev_Team) commonly uses the phrase "send donations to <code>/dev/null</code>", meaning they do not accept donations.<ref>{{Cite web|url=http://blog.iphone-dev.org/post/41744653/donations-to-devnull|title=Dev-Team Blog - Donations to /dev/null|date=2015-09-07|access-date=2018-11-15|archive-url=https://web.archive.org/web/20150907154408/http://blog.iphone-dev.org/post/41744653/donations-to-devnull|archive-date=2015-09-07}}</ref> The fictitious person name "Dave (or Devin) Null" is sometimes similarly used (e.g., "send complaints to Dave Null").<ref name="Goodman 2004 p. 170">{{cite book |last=Goodman |first=Danny |title=Spam Wars: Our Last Best Chance to Defeat Spammers, Scammers, and Hackers |publisher=SelectBooks |location=New York |year=2004 |url={{Google books|kUp6p5P8wao|page=170|plainurl=yes}} |isbn=9781590790632 |oclc=1036874851 |page=170}}</ref> In 1996, [Dev Null](/source/Dev_Null) was an animated [virtual reality](/source/virtual_reality) character created by [Leo Laporte](/source/Leo_Laporte) for MSNBC's computer and technology TV series ''[The Site](/source/The_Site)''. Dev/null is also the name of a vampire hacker in the computer game [Vampire: The Masquerade – Redemption](/source/Vampire%3A_The_Masquerade_%E2%80%93_Redemption). A 2002 advertisement for the Titanium [PowerBook G4](/source/PowerBook_G4) reads "Sends other UNIX boxes to /dev/null."<ref name="macnn">{{cite web|url=http://www4.macnn.com/macnn/articles/unixad.jpg |title=Image: unixad.jpg, (1094 × 720 px) |access-date=2015-09-02 |url-status=dead |archive-url=https://web.archive.org/web/20130326010431/http://www4.macnn.com/macnn/articles/unixad.jpg |archive-date=March 26, 2013 }}</ref>

The null device is also a favorite subject of technical jokes,<ref>{{cite web|url=http://docs.freebsd.org/doc/6.1-RELEASE/usr/share/doc/faq/funnies.html#DEV-NULL |title=The FreeBSD Funnies |publisher=Freebsd.org |access-date=2012-11-28}}</ref> such as warning users that the system's <code>/dev/null</code> is already 98% full. The 1995 [April Fool's](/source/April_Fools'_Day) issue of the [German](/source/Germany) magazine ''[c't](/source/c't)'' reported on an enhanced <code>/dev/null</code> [chip](/source/integrated_circuit) that would [efficiently dispose](/source/entropy) of the incoming data by converting it to a flicker on an internal glowing [LED](/source/light-emitting_diode).

Dev/Null is also the name of an electronic dance music producer and jungle DJ.<ref>{{Cite magazine |title=Dev Null Microjunglizm |url=https://www.newyorker.com/goings-on-about-town/night-life/devnull-microjunglizm |access-date=2024-01-24 |magazine=The New Yorker |language=en}}</ref>

== See also ==
{{columns-list|
* {{mono|[:/dev/full](/source/%3A%2Fdev%2Ffull)}}
* {{mono|[:/dev/zero](/source/%3A%2Fdev%2Fzero)}}
* [Device file](/source/Device_file)
* [Filesystem Hierarchy Standard](/source/Filesystem_Hierarchy_Standard)
* [Memory hole](/source/Memory_hole)
* [{{mono|rm}} (Unix)](/source/rm_(Unix))
* [Standard streams](/source/Standard_streams)
* [Unix philosophy](/source/Unix_philosophy)
* [Write-only memory](/source/Write-only_memory_(engineering))
}}

== Notes ==
{{Notelist}}

== References ==
{{Reflist|60em}}

{{nulls}}

Category:CP/M technology
Category:Unix file system technology
Category:Device file
Category:Computer humour

---
Adapted from the Wikipedia article [Null device](https://en.wikipedia.org/wiki/Null_device) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Null_device?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
