Share on Facebook Share on Twitter Email
Answers.com

/dev/zero

 

/dev/zero is a special file in Unix-like operating systems that provides as many null characters (ASCII NUL, 0x00) as are read from it. One of the typical uses is to provide a character stream for initializing data storage.

Function

Read operations from /dev/zero return as many null characters (0x00) as requested in the read operation.

Like /dev/null, /dev/zero may be used not only as a source, but also as a sink for data. All write operations to /dev/zero succeed with no other effects. However, /dev/null is more commonly used for this purpose.

When /dev/zero is memory-mapped, e.g., with mmap, to the virtual address space, it is equivalent to using anonymous memory, i.e. memory not connected to any file.

Examples

The dd Unix utility program reads octet streams from a source to a destination, possibly performing data conversions in the process. Destroying existing data on a file system partition:

dd if=/dev/zero of=/dev/<destination partition>

Creating a 1 MiB file, called foobar, filled with zeroes:

dd if=/dev/zero of=foobar count=1024 bs=1024

See also


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
 
 

 

Copyrights:

Wikipedia on Answers.com. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article /dev/zero Read more

Follow us
Facebook Twitter
YouTube