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:
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.
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
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 thels -loutput, the first character tells you the type of device, in this case ‘c’ for character. So the command to run to recreate it is:And of course, don’t forget to
chmod 666it!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.[Comment removed by author]
Meh, I think most people just restart the machine while telling load balancers to direct traffic somewhere else.
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/nullkind of interesting? What would be a “sane” way of looking at a chunk of stuff going there?Though the fact that
/dev/nullexists has always felt like an indication of a problem with your abstractionSome variant of strace or ktrace should let you see what’s going into null.
mkfifo and tee maybe?