| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 4 |
.\" |
| 5 |
.TH null 4 2025-05-17 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
null, zero \- data sink |
| 8 |
.SH DESCRIPTION |
| 9 |
Data written to the |
| 10 |
.I /dev/null |
| 11 |
and |
| 12 |
.I /dev/zero |
| 13 |
special files is discarded. |
| 14 |
.P |
| 15 |
Reads from |
| 16 |
.I /dev/null |
| 17 |
always return end of file (i.e., |
| 18 |
.BR read (2) |
| 19 |
returns 0), whereas reads from |
| 20 |
.I /dev/zero |
| 21 |
always return bytes containing zero (\[aq]\[rs]0\[aq] characters). |
| 22 |
.P |
| 23 |
These devices are typically created by: |
| 24 |
.P |
| 25 |
.in +4n |
| 26 |
.EX |
| 27 |
mknod \-m 666 /dev/null c 1 3 |
| 28 |
mknod \-m 666 /dev/zero c 1 5 |
| 29 |
chown root:root /dev/null /dev/zero |
| 30 |
.EE |
| 31 |
.in |
| 32 |
.SH FILES |
| 33 |
.I /dev/null |
| 34 |
.br |
| 35 |
.I /dev/zero |
| 36 |
.SH NOTES |
| 37 |
If these devices are not writable and readable for all users, many |
| 38 |
programs will act strangely. |
| 39 |
.P |
| 40 |
Since Linux 2.6.31, |
| 41 |
.\" commit 2b83868723d090078ac0e2120e06a1cc94dbaef0 |
| 42 |
reads from |
| 43 |
.I /dev/zero |
| 44 |
are interruptible by signals. |
| 45 |
(This change was made to help with bad latencies for large reads from |
| 46 |
.IR /dev/zero .) |
| 47 |
.SH SEE ALSO |
| 48 |
.BR chown (1), |
| 49 |
.BR mknod (1), |
| 50 |
.BR full (4) |