Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Devices

Devices are represented by two types of files: Block Devices and Char Devices.

Each device file is also associated with a major and minor number, allowing to identify it.

Those files are usually present in the /dev directory.

Device type abbreviations:

  • C = Char Device
  • B = Block Device

The following sections describe devices that may be present on the system. This list may be extended by kernel modules and as such, doesn’t include every possible devices.

Default devices list

The following devices are present on the system by default.

PathTypeMajorMinorDescription
/dev/nullC13This device does nothing. Reading from it returns EOF and writing to it discards the data
/dev/zeroC15Reading returns an infinite amount of zeros bytes and writing to it discards the data
/dev/randomC18Reading returns random bytes and writing to it feeds the kernel’s entropy pool. If not enough entropy is available, reading is blocking
/dev/urandomC19Reading returns random bytes and writing to it feeds the kernel’s entropy pool. Contrary to /dev/random, reading is never blocking
/dev/kmsgC111Reading returns kernel logs and writing appends kernel logs
/dev/ttyC50Device representing the TTY of the current process

Dynamic devices

This section describes devices that may or may not be present depending on the system’s peripherals.

PathTypeMajorMinorDescription
/dev/sdXB8n * 16A SCSI drive. X has to be replaced by a single letter. Each disk has its own unique letter. n is the number associated with the letter (a -> 0, b -> 1, etc…)
/dev/sdXNB8n * 16 + N + 1A partition on a SCSI drive. This device works the same as the previous, except N is the partition number