What Can You Do with an Empty File?

It isn't a file, actually, though you can use it like one. /dev/null is a UNIX device. [4] It's not a physical device. /dev/null is a special device that "eats" any text written to it and returns "end-of-file" (a file of length 0) when you read from it. So what the heck can you use it for?

[4] Well, okay. It's a device file.

Another interesting device (mostly for developers) is /dev/zero. When you read it, you'll get ASCII zeros (NUL characters) () forever. There are no newlines either. For both of those reasons, many UNIX commands have trouble reading it. If you want to play, the command below will give you a start (and head () will give you a stop!): [5]

[5] On some UNIX versions, the head program may not terminate after it's printed the first ten lines. In that case, use sed 10q instead of head.

fold od 
% fold -20 /dev/zero | od -c | head

- JP