Jump to content

/dev/zero

From Wikipedia, the free encyclopedia
  1. REDIRECTTemplate:Distinguish

Template:Rcat shell Template:Short description Template:Use dmy dates Template:Mono is a special file in Unix-like operating systems that provides as many null characters (ASCII NUL, 0x00) as are read from it.[1] One of the typical uses is to provide a character stream for initializing data storage.[2]

Function

Read operations from Template:Mono return as many null characters (0x00) as requested in the read operation.

All write operations to Template:Mono succeed with no other effects. Template:Mono is more commonly used for this purpose.

When Template:Mono 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.

History

Template:Mono was introduced in 1988 in SunOS-4.0 to allow a mappable BSS segment for shared libraries using anonymous memory.[3] HP-UX 8.x introduced the MAP_ANONYMOUS flag for mmap(), which maps anonymous memory directly without a need to open Template:Mono.[4] Since the late 1990s, MAP_ANONYMOUS[5] or MAP_ANON are supported by most UNIX versions, removing the original purpose of Template:Mono.[6]

Examples

Template:Cite-section

Erasing a USB flash drive using DD:

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

This may not perform a secure erasure and may not destroy any data, but may take significantly more time than required for this purpose.Template:Cn

Creating a Template:Val file, named foobar, filled with null characters:

Template:Sxhl

See also

References

Template:Reflist

  1. ↑ Template:Citation
  2. ↑ Template:Citation
  3. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  4. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  5. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  6. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}