NAME
null − data sink
DESCRIPTION
Data written on a null special file is discarded.
Reads from a null special file always return 0 bytes.
FILES
/dev/null
In present-day, opening /dev/null for reading and writing is allowed for everyone, and yields a file descriptor corresponding to a special file where any read returns empty and any write does nothing but return OK.[xbd2024,a][xrat2024,a] This is observed universally now,[Linux7null][NetBSDnull][SORTIXnull] but wasn't always.
Four axes are of interest when evaluating historical systems like
open("/dev/null", O_RDONLY)[sh4]
Memory special file(
mem) minor device 2 is EOF/RATHOLEis fully-formed[kernel4,b]
with a `<', its input is […] redirected to the zero length file /dev/null.
FILES
/dev/null as a source of end-of-file.
mem[kernel4a]
mem as character major 1[kernel5a]
mem is now mandatory and always major 1[kernel5,b]
core memory) now mentions[upm5]
and describesFILES
/dev/mem, /dev/kmem, /dev/null
The file null returns end-of-file on read and ignores write.
mem, kmem, null, speak(VI) has an example of:[upm6]
(cat speak.v; echo !w speak.m) ⎪ speak -v /dev/null(/dev/null is the vocabulary input).
Setting Up UNIX − Sixth Edition affirms the distributed filesystem state:[setup6]
The files tty8 (console), mem, kmem, null are already correctly configured.
mem as character major 8[kernel7a,b]
the empty file,[upm7][sh7] but Uucp Implementation Description documents it as the default for standard input and output[uucp7] and dd(1) & Setting Up UNIX − Seventh Edition recommend
dd of=/dev/null for skipping "files" on tape.[upm7a][setup7]
The only recommendation for direct usage is in Typesetting Mathematics — User's Guide as a USP:[eqn7]
If you want to check a document before actually printing it (on unix only),mem(4) splits into new null(4), reproduced in its entirety below.[upm7b]eqn files >/dev/nullwill throw away the output but print the messages.
NAME
null − data sink
DESCRIPTION
Data written on a null special file is discarded.
Reads from a null special file always return 0 bytes.
FILES
/dev/null
Pwb/unix and CB-UNIX kernels say that minor device 2 is EOF/NULL
instead;[kernelPWB]
CB-UNIX's implementation is novel.[kernelCB]
They use their respective base distributions' manual pages.[upmPWB][upmCB]
| unix | acceptable | installed | possible | documented |
|---|---|---|---|---|
| 1, 2, 3 | any | none | empty a=r file | – |
| 4 | device empty a=r file | empty a=r file | device empty a=r file | just for sh(I), as readable |
| 5 | a=rw device | & under mem(IV) as read-write | ||
| 6 | & in setup | |||
| 7 | a=rw device | device | as read-write in null(4) with global perfusion |
A file that refers to a device (such as a terminal device file) or that has special properties (such as /dev/null).
The following files shall exist on conforming systems and shall be both readable and writable:/dev/null An empty data source and infinite data sink. Data written to /dev/null shall be discarded. Reads from /dev/null shall always return end-of-file (EOF).
The standard files /dev/null and /dev/tty are required to be both readable and writable to allow applications to have the intended historical access to these files.
Since /dev/null is not a regular file, no error is generated by redirecting to it in noclobber mode.
shell (command interpreter)), ll. 294-297, 302
shell (command interpreter)) & mem(IV) (5/27/74,
core memory)
shell (command interpreter)) & mem(IV) (5/27/74,
mem, kmem, null − core memory) & speak(VI) (4/26/75,
word to voice translator)
command language)
data sink), /man/man4/null.4
core memory)
Nit-pick? Correction? Improvement? Annoying? Cute? Anything?
Mail,
post, or open!