024. History of /dev/null

Wed, 13 May 2026 15:12:04 +0200

Contents

      1. Versions 1-3 unix
      2. Version 4 unix
      3. Version 5 unix
      4. Version 6 unix
      5. Version 7 unix
      6. The Published Apocrypha
      7. Conclusion
      8. References

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

# Versions 1-3 unix

  1. filesystem as-shipped (and as-configured): —
  2. userspace conventions: none
  3. kernel support: N/A
  4. manual attitude: nothing of /dev/null's sort mentioned

# Version 4 unix

  1. filesystem as-shipped: /dev/null is a regular file, size 0, access a=r[null4]
  2. userspace conventions: only user is sh as open("/dev/null", O_RDONLY)[sh4]
  3. kernel support: Memory special file (mem) minor device 2 is EOF/RATHOLE is fully-formed[kernel4,b]
  4. manual attitude: only mentioned in sh(I):[upm4]
    with a `<', its input is […] redirected to the zero length file /dev/null.

    FILES

    /dev/null as a source of end-of-file.
  5. … (and as-configured): the distribution kernel is configured without mem[kernel4a]

# Version 5 unix

  1. filesystem as-shipped (and as-configured): /dev/null is a character device major 1 minor 2, access a=rw;[null5] distribution kernel configured with mem as character major 1[kernel5a]
  2. userspace conventions: same as Version 4 unix[sh5]
  3. kernel support: same as Version 4 unix, but mem is now mandatory and always major 1[kernel5,b]
  4. manual attitude: same as Version 4 unix, mem(IV) (core memory) now mentions[upm5]

    FILES

    /dev/mem, /dev/kmem, /dev/null
    and describes
    The file null returns end-of-file on read and ignores write.

# Version 6 unix

  1. filesystem as-shipped (and as-configured): same as Version 5 unix[null6][kernel6a]
  2. userspace conventions: same as Version 5 unix[sh6]
  3. kernel support: same as Version 5 unix[kernel6,a]
  4. manual attitude: sh(I) same as Version 5 unix, mem(IV) is now 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.

# Version 7 unix

  1. filesystem as-shipped (and as-configured): /dev/null is a character device major 8 minor 2, access a=rw;[null7] distribution kernels configured with mem as character major 8[kernel7a,b]
  2. userspace conventions: freely uses /dev/null for empty input and to discard output[userspace7,a]
  3. kernel support: same as Version 6 unix, but mem is always major 8[kernel7,a,b]
  4. manual attitude: the Bourne shell similarly calls /dev/null 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),
    eqn  files >/dev/null
    will throw away the output but print the messages.
    mem(4) splits into new null(4), reproduced in its entirety below.[upm7b]

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

# The Published Apocrypha

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]

# Conclusion

/dev/null
unix acceptable installed possible documented
1, 2, 3any 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

# References

Linux7null
Linux 7.1-rc3, drivers/char/mem.c, ll. 714, 679-692
NetBSDnull
NetBSD src 2026-05-11, sys/sys/conf.h l. 271, sys/dev/mm.c ll. 351-356, etc/MAKEDEV.tmpl l. 966,
SORTIXnull
sortix 2026-05-11, kernel/kernel.cpp ll. 587-593, kernel/fs/null.{h,cpp}
xbd2024
IEEE Std 1003.1™-2024, IEEE Standard for Information Technology—Portable Operating System Interface (POSIX™), Base Specifications, Issue 8, Microprocessor Committee of the IEEE Computer Society and The Open Group, 14 June 2024, 979-8-8557-0793-9, STD26978, Vol. 1: Base Definitions, Issue 8, 3.62: Character Special File, p. 40, ll. 1285-1287
A file that refers to a device (such as a terminal device file) or that has special properties (such as /dev/null).
a
ibid., 10.1: Directory Structure and Files, p. 197, ll. 7043-7045
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).

xrat2024
ibid., Vol. 4: Rationale (Informative), Issue 8, A: Rationale for Base Definitions, A.10.1: Directory Structure and Files, p. 3717 ll. 127679-127680
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.
a
ibid., C: Rationale for Shell and Utilities, C.2: Shell Command Language, C.2.7: Redirection, p. 3891, ll. 135049
Since /dev/null is not a regular file, no error is generated by redirecting to it in noclobber mode.
upm4
UNIX Programmer's Manual, Fourth Edition, K. Thompson & D. M. Ritchie, November, 1973, sh(I) (4/18/73, shell (command interpreter)), ll. 294-297, 302
sh4
ibid., /usr/source/s2/sh.c, l. 601
upm5
UNIX Programmer's Manual, Fifth Edition, K. Thompson & D. M. Ritchie, June, 1974, sh(I) (5/15/74, shell (command interpreter)) & mem(IV) (5/27/74, core memory)
kernel5
Dennis Ritchie, v5root.tar.gz, distributed by TUHS, ./usr/sys/dmr/mem.c
a
ibid., /usr/sys/conf/conf.c ll. 11-19
b
ibid., /usr/sys/conf/mkconf.c ll. 28-34
sh5
ibid., ./usr/source/s2/sh.c, l. 641
null5
Dennis Ritchie, v5root.gz, distributed by TUHS, /dev/null
upm6
UNIX Programmer's Manual, Sixth Edition, K. Thompson & D. M. Ritchie, May, 1975, sh(I) (5/15/74, shell (command interpreter)) & mem(IV) (5/27/74, mem, kmem, null − core memory) & speak(VI) (4/26/75, word to voice translator)
setup6
Ken Thompson & Dennis Ritchie, Setting Up UNIX − Sixth Edition, Special Files, para. 4
kernel6
Dennis Ritchie, v6root.tar.gz, distributed by TUHS, ./usr/sys/dmr/mem.c
a
ibid., /usr/sys/conf/mkconf.c ll. 60-66
sh6
Dennis Ritchie, v6src.tar.gz, distributed by TUHS, ./s2/sh.c, l. 668
null6
Dennis Ritchie, v6root.gz, distributed by TUHS, /dev/null
upm7
UNIX™ Time-Sharing System: UNIX Programmer's Manual, Seventh Edition, Volume 1, January, 1979, Bell Telephone Laboratories, Incorporated, Murray Hill, New Jersey, sh(1) (command language)
a
ibid., dd(1) (convert and copy a file), /man/man1/dd.1 l. 587
b
ibid., null(4) (data sink), /man/man4/null.4
sh7
S. R. Bourne, An Introduction to the UNIX Shell, 3.7 Command execution, (/usr/doc/shell/t3 ll. 727-733)
setup7
Charles B. Haley & Dennis M. Ritchie, Setting Up UNIX − Seventh Edition, Special Files, (/usr/doc/setup l. 244)
uucp7
D. A. Nowitz, Uucp Implementation Description, Standard Input Line & Standard Output Line
eqn7
Brian W. Kernighan and Lorinda L. Cherry, Typesetting Mathematics — User's Guide, (/usr/doc/eqn/g4 ll. 205-213)
kernel7
Unsullied translation of the TUHS Keith_Bostic_v7 V7 UNIX distribution rootfs and /usr to tar, Keith Bostic, f6.gz (/usr), distributed by TUHS, /sys/dev/mem.c
a
ibid., /sys/conf/mkconf.c ll. 35, 73-81, 659-667
b
ibid., /sys/conf/c.c l. 50
null7
ibid., f5.gz (root), distributed by TUHS, /dev/null
upmPWB
Pwb/unix, Edition 1.0, T. A. Dolotta, R. C. Haight, E. M. Piskorik, eds., May 1977, Bell Telephone Laboratories, Incorporated, mem(IV) (5/31/77, core memory)
kernelCB
CB-UNIX kernel source, conf.70.c 2.16, Page 2 & mem.c 2.7.1.1
upmCB
CB-UNIX Programmer's Manual, Edition 2.3, J. D. Doan, ed., May 1981, Department 59473, Bell Telephone Laboratories, Incorporated, null(IV) (November 1979, the null file) [content identical to [upm7] beside the title line]


Nit-pick? Correction? Improvement? Annoying? Cute? Anything? Mail, post, or open!


nabijaczleweli.xyz : CC-BY 4.0 : src/blogue/024-dev-null.html.pp (GitHub) : built on 13.05.2026 13:23:40 UTC with Clang's 21 C preprocessor : build job (builds.sr.ht) : RSS feed : liberapay donate : patreon : mastodon fediverse twitter tweet : efb59f77-4d29-11f1-a3a7-94de80ae55d5