UP | HOME

Device File

Device files can be found under /dev.

In linux, everything is treated as a file. That is to say, everything is treated as a string of bytes, and every string of bytes can be accessed in the same way.

For example, a partition of the SSD in my laptop would be correspond to a device file. You would write and read blocks to that disk by using dd or cat on the device file.

The physical nitty gritty of writing the blocks is handled by a device driver.

As an aside, there are two types of devices: block devices, as above, or character stream devices, e.g. a computer mouse.

Instead of writing blocks directly to a device file, most users mount the device in the Virtual File System.

Created: 2024-07-15 Mon 01:27