Breaking News
Home / Sys Admin / Unix / What is dev/null?

What is dev/null?

Unix dev nullIn Unix-like operating systems, the various devices in the computer are referenced via
/dev/sda(Hard Drive), /dev/cdrom (CD Drive) etc. But there is a null device (referenced via /dev/null) which is a special file that discards all data written to it (but reports that the write operation succeeded), and provides no data to any process that reads from it (yielding EOF immediately ).

In programmer’s jargon, especially Unix jargon, it may also be called the bit bucket or black hole. Essentially nothing can be really read or written to it.

Since /dev/null is a special file, not a directory, so one cannot move files into it with the Unix mv command and nor one cannot apply any other file manipulation commands on it.

So the question that comes to mind, why have it?
The null device is typically used for disposing of unwanted output streams of a process, or as a convenient empty file for input streams. This is usually done by redirection.

/dev/null redirection


Check Also

How to list disks information in Linux?

In order to check the disk in the system we can use the List Hardware …

Advertisment ad adsense adlogger