null(4)
β¨ NAME β¨
okay bestie, meet null and zero β they're the data sink π
this is null(4), aka the kernel interfaces manual page for the two most unbothered devices in all of Linux π«Ά
πΈ DESCRIPTION πΈ
Anything you write to the special files /dev/null and /dev/zero? gone. literally just discarded, no thoughts, head empty, bye πβ¨
But the reads? that's where they're not the same, and this is the part you gotta remember:
- Reads from
/dev/nullalways return end of file β meaningread(2)returns0π it's giving "i have nothing for you and i will never have anything for you." - Reads from
/dev/zeroalways return bytes containing zero (those'\0'characters) β so it will happily keep handing you zeros forever, it never runs out π
These devices are typically created by:
mknod -m 666 /dev/null c 1 3
mknod -m 666 /dev/zero c 1 5
chown root:root /dev/null /dev/zero
copy those exactly, no cap π
π FILES π
/dev/null/dev/zero
π NOTES π
β οΈ If these devices are not writable and readable for all users, many programs will act strangely. like, strangely strangely. bestie do not skip the permissions on this one, it's the whole vibe check π
Also, important lore: since Linux 2.6.31, reads from /dev/zero are interruptible by signals π¦ (this change was made to help with bad latencies for large reads from /dev/zero) β so yeah, the kernel fixed that for us, iconic behavior honestly π
π₯ SEE ALSO π₯
and that's the whole page, bestie π this was Linux man-pages 6.20, dated 2025-05-17 β go forth and pipe things into the void, mwah ππ§β¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms