/Dev/null and/dev/zero

Source: Internet
Author: User
1. Introduction-Interpretation from Wikipedia

/Dev/null: in Unix-like systems,/dev/null, or an empty device, is a special device file, it discards all data written to it (but reports that the write operation is successful), and reads it to get an EOF immediately.
In a programmer's line, especially a Unix line,/dev/null is called a bit bucket or a black hole ). Empty devices are usually used to discard unwanted output streams or empty files used as input streams. These operations are usually completed by redirection.


/Dev/Zero: in Unix-like operating systems,/dev/zero is a special file. When you read it, it provides unlimited null characters (null, ascii nul, 0x00 ).

One typical usage is to overwrite information with the volume stream provided by it. Another common usage is to generate a blank file of a specific size. BSD maps/dev/zero to the virtual address space through MMAP to implement shared memory. MMAP can be used to map/dev/zero to a virtual memory space. The effect of this operation is equivalent to using an anonymous memory (not related to any files ).

/Dev/null and/dev/zero

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.