12

I'm looking for some historic info about the null device. Why was it called /dev/null instead of (for example) /dev/empty?

FreeBSD's manual page states that "A null device appeared in Version 7 AT&T UNIX" but I can't find any reference or hint about why that name was originally chosen.

If it turns out that the name was originally used in a more ancient OS, I'd like to know how the original device worked and why that name was chosen.

7
  • /dev/null is one of very few pathnames standardized by POSIX. And even non-Unix-like systems call it that way (probably because Unix did it first). Dec 26, 2016 at 22:59
  • 1
    @Gilles ok but why? What the history behind this specific name? Dec 27, 2016 at 14:42
  • 2
    I've removed everything except the core question itself from here in the hope that that makes it clearer as a historical question; if I've interfered with what you wanted it to say please roll it back. Dec 30, 2016 at 21:40
  • 2
    The FreeBSD manual page is correct but somewhat misleading.  The null device, called /dev/null, was present in Version 6 Unix, in the mid 1970s.  (BTW, /dev/zero was added much later.) Unfortunately, I have no supporting evidence. Jan 1, 2017 at 23:12
  • "on unix an "always blocking file" could be used to wait for signals." As it turns out, there's a system call that's used to wait for signals - pause(). Jan 5, 2017 at 15:52

2 Answers 2

7

null was chosen because it discards any data sent, pretty much like a void place. That's why its also called black hole.

It is a character device, a stream that has no connection to a real space in memory. Fun fact is that you can make your own personalized /dev/null with mknod -m 666 /dev/null c 1 3.

Additionally, it sends EOF if you try to read from it.

0
2

'null' means 'nothing', 'without value', and so on.

'empty' implies a container. For emptiness to exist we need a container.

In computer science in which zero is a value, we need a term for 'nothing'. So we have the 'null pointer' for example which is, functionally, a pointer to nothing.

'/dev/null' is the 'nothing device'. If we want something to disappear into nothingness, we give it to the nothing device.

If we give something to /dev/empty then the 'empty' device is no longer empty but is the container of the thing we sent to it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .