Just in case anyone else is in the same unfortunate position and wants to know the major and minor mknod numbers for /dev/null, they are 1 and 3. Also a part of the ls -l output, the first character tells you the type of device, in this case ‘c’ for character. So the command to run to recreate it is:
mknod /dev/null c 1 3
And of course, don’t forget to chmod 666 it!
I suffered from a bug where Emacs would crash and somehow /dev/null got deleted. Had to make sure I had a script which contained that!
It’s only 1 and 3 for one particular system. For another system, it’s 3 and 2. And yet on a third, it’s 13 and 2. I’ll leave it up to the reader to figure out which Unix systems I checked.
On Linux, this info is given in the manpage for null(4).
[Comment removed by author]
Is that from BSD systems? I’m not familiar with MAKEDEV.
people must resort to manual mknod repairs nowadays?
Meh, I think most people just restart the machine while telling load balancers to direct traffic somewhere else.
<MacBook-Pro>: ls -l /dev/null
crw-rw-rw- 1 root wheel 3, 2 Apr 12 15:07 /dev/null
Both of these ideas are stupid, but what he did next was even more stupid: he decided to replace /dev/null with a plain file so that he could examine its contents.
I get that making a plain file isn’t too smart, but seriously: Isn’t the idea of looking at what’s going into /dev/null kind of interesting? What would be a “sane” way of looking at a chunk of stuff going there?
Though the fact that /dev/null exists has always felt like an indication of a problem with your abstraction
Some variant of strace or ktrace should let you see what’s going into null.
mkfifo and tee maybe?