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