Taken from http://www.techiesabode.com


Special devices in Linux


There are a few special devices in Linux that come in useful every once in a
while, /dev/null, /dev/zero, /dev/full, and /dev/random.

The null device, /dev/null, is sort of the "trash" device. Put simply,
things that go in never come out. Many times, some program may generate
unnecessary output. Shell scripts often employ /dev/null to prevent the user
from having to see unnecessary output generated by utilities that it calls.
The example below starts the X server and redirect the output to null device

$ startx > /dev/null

In the following command, both stderr and stdout are redirected to null
device

$ startx > /dev/null 2>&1

Closely related to /dev/null is /dev/zero. Like /dev/null, it can be used to
dump unwanted data, but reads from /dev/zero return ? characters (reads from
/dev/null return end-of-file characters). For this reason, /dev/zero is
commonly used to create empty files.

***** /dev/zero returns '\0' characters (ASCII Value 0x0) but not the number
zero (ASCII Value 0x30)****

/dev/full mimics a full device. Writing to /dev/full will generate an error.
/The full device is useful when testing how an application will act when it
/accesses a device that is full.

$ cp test-file /dev/full
cp: writing `/dev/full": No space left on device

The random devices, /dev/random and /dev/urandom, generate "random" data.
Though the output to both may appear to be completely random, /dev/random is
actually more random than /dev/urandom. /dev/random generates random
characters based on "environmental noise" that is not determinable. Since
there is only a limited supply of this random noise, the /dev/random device
is slow, and may pause in order to collect more data. /dev/urandom uses the
same pool of noise as /dev/random, but if it runs out of random data, it
generates pseudo-random data. This makes it faster, but less secure.         


Taken from http://www.techiesabode.com