image Ref: The UNIX Time-Sharing System, Dennis M. Ritchie and Ken Thompson, Bell Laboratories

image

image

image

image

Ref: https://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/dev.html

For example:

The null device in Unix systems is /dev/null.

image

If we wanted to send a specific file descriptor output, we would use 1> for stdout and we would use 2> for stderr.

A &> sends both stdout and stderr file descriptors to /dev/null.

image

Devices

Linux splits all devices into three classes: block devices, character devices, and network devices.

image

A character-stream device transfers bytes one by one, whereas a block device transfers a block of bytes as a unit.

Block devices

Character devices

Character devices include most other devices, such as mice and keyboards.

The fundamental difference between block and character devices is random access—block devices are accessed randomly, while character devices are accessed serially. For example, seeking to a certain position in a file might be supported for a DVD but makes no sense for a pointing device such as a mouse.

Network devices

Network devices are dealt with differently from block and character devices. Users cannot directly transfer data to network devices. Instead, they must communicate indirectly by opening a connection to the kernel’s networking subsystem.

image

image

Special files for char drivers are identified by a “c” in the first column of the output of ls -l. Block devices appear in /dev as well, but they are identified by a “b.” The focus of this chapter is on char devices, but much of the following information applies to block devices as well.