Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The only bug with it was due to my own stupidity. I wanted a quick way to see how fast a drive was, thus sending one of its large files to /dev/null was fine. Except I went too fast and cp'd the file to /dev/null.

It took a while before noticing I had no more /dev/null on the machine (read: the time needed to fill the rootfs). In a panic, I removed the file.

Seeing the machine collapse due to /dev/null missing was fun.





Wait, you can actually remove /dev/null? I always thought of it as a special driver file

I guess that might not be true for all nixes out there


/dev/null is a device file, and can be removed by root, or any user with write access to the /dev directory itself.

You can recreate it with 'mknod /dev/null c 1 3; chmod 666 /dev/null'.

The '1 3' are the major and minor device numbers, respectively, which are assigned / maintained by LANA, the Linux Assigned Numbers Authority.


Each item in the unix filesystem can be one of the following: file, directory, symlink, device node, socket, fifo.

So nothing's stopping you from making it a normal file and capturing all the output programs send to it.

For super funsies you can make it a symlink or socket, but I think most programs won't work if it's a socket.

Nothing also is stopping you from removing it and mknod'ing a /dev/null into another device file, such as the one /dev/full or /dev/zero uses, or /dev/fb0 if you wanna be really silly.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: