Character device 2026-11-05
A character device is a device interface accessed through a character-special device node. In the Linux model, the node's file metadata identifies character-device type and a represented device number; the device driver defines the supported read, write and control operations. The word character does not restrict the exchanged data to readable text.[ref]
A useful concrete example is /dev/null. Data written to it are discarded, and a read returns zero bytes to indicate end of file. /dev/zero also discards writes but supplies zero-valued bytes on reads.[ref] These two interfaces have different behaviours even though both use character-special files.
For an original byte-level trace, suppose an application successfully writes the three bytes 41 00 42 to /dev/null. A later read does not return those bytes: the interface is a data sink. A read requesting three bytes from /dev/zero, if completed without interruption, instead supplies 00 00 00. The embedded zero byte in the write and zero bytes in the read are ordinary binary values, not restrictions to a text alphabet.
The familiar file descriptor operations provide a common access framework, but their meanings depend on the device. A video device node can offer format negotiation and buffer controls through Video4Linux; another character device may expose a stream. Character-device type alone does not promise ordinary-file storage, a particular message boundary or a useful seek operation.
The distinction from a block device concerns the interface category. A device node is the named file system object, while the character device is the interface it represents. Several nodes can identify the same represented interface, and a pathname's inode identity does not by itself identify a distinct physical peripheral.
Minor device number 2026-11-05
A minor device number is the second component of a device number. In the Linux interface, minor(d) extracts it from a value of type dev_t; the matching major device number supplies its device-class context.[ref]
A concrete Linux allocation distinguishes two character-special interfaces sharing major1: /dev/null has minor3, while /dev/zero has minor5.[ref] The former supplies end-of-file when read, while the latter supplies zero-valued bytes. Their different minor values select different interface behavior within the same major allocation.[ref]
For an original pair comparison, let two registered character-device interfaces have numbers and . Both have minor7, but their complete device numbers differ. Conversely, and share a major while selecting different minor values within it. A minor value alone is therefore insufficient to identify the interface.
Minor numbers are interpreted in the relevant device allocation; there is no universal rule that every minor counts disks, partitions or physical pieces of hardware. The device may also be a purely virtual interface. The conversion functions preserve the structured components:
for supported component values. Extracting the component with the documented interface avoids assuming an implementation-specific bit packing.