Found in Linux and Unix operating systems, /dev/zero is a special file that provides null characters (ASCII character NULL – 0x00; not ASCII character “zero” or “0” – 0x30). While it may seem similar to the special file /dev/null, it actually does the opposite. The file /dev/null acts as a data sink, an imaginary “black hole,” where all writes to it are discarded and no data is returned from processes reading from it. On the other hand /dev/zero acts as a source. All writes to /dev/zero are successful (the same goes for /dev/null).


  1. Used to wipe data from a file. /dev/zero can fill out a file with null characters. (It is not sufficient to use this method for wiping out file data from disk.)
    ~# dd if=/dev/zero of=/dev/hda2
    (Note: The following command will erase all files that are in the partition. Try at your own risk!)
  2. Can generate a new file of a certain size.
    ~# dd if=/dev/zero of=foobar bs=1024 count=1
    (Creates an empty file called ‘foobar’)

Similar Posts:

Notice: This article was published on October 9, 2006 and the content above may be out of date.