/ dev / null

from Wikipedia, the free encyclopedia

/ dev / null is the implementation of the zero device ( English null device ) as a special file in Unix - operating systems . It has its origin /dev/nullin the operating system UNIX Version 7 from 1977, the behavior of the implementation was defined in the POSIX standard.

This is essential for SUS -certified and POSIX-compliant UNIX operating /dev/nullsystems. Many other Unix-like operating systems, including BSD- based Unix such as the BSD successor projects NetBSD , FreeBSD and OpenBSD as well as Linux , adhere to the standard specified with POSIX for the null device. On other operating systems, /dev/nullPOSIX-compliant Unix shells are also implemented, for example with Cygwin under Windows .

use

If /dev/nullthe output is addressed, a data stream to be output is discarded. When read access to ( entry ) is a single end-of-file character ( EOFissued). The primary use of /dev/nullis to discard expenses.

In addition, the null device can also serve as a pseudo addressee. For example, the command copies

cp Datei /dev/null

(see cp) the mentioned source file, in the example Datei, effectively nowhere, but by reading the source file, which is necessary for the process, on the one hand its complete readability is determined ( i.e. serves as a kind of selective fsck ), on the other hand the source file is loaded into the disk cache by reading , which speeds up any subsequent use. Moreover - depends on the file system  of the - inode -content changed because the access time stamp ( English time access , short atime ) is reset.

Read accesses only deliver a single end-of-file symbol, which is why it can also be used to generate "empty entries". The following example creates a new, empty file by copying the device file:

cp /dev/null "leere Datei.txt"

Reception in net culture

In net culture , /dev/nulla term used colloquially expresses disinterest in or contempt for an object by suggesting its rejection. An example would be the pseudo command mv program /dev/null, which amounts to “throw the program away”.

The saying “For backups there is / dev / null, for restores / dev / random …” is also known, which sarcastically comments on the often little or insufficiently tested backup procedures.

See also

Individual evidence

  1. NULL (4) FreeBSD manpage .
  2. The Open Group Base Specifications Issue 7 - Directory Structure and Devices (Eng.)