Device Files

Device Files

You know, I love these little mini-series on specific elements of your Linux system. They give us the opportunity to dig a bit more deeply into the core functions, placing a strong emphasis on the subtelties and potential “land-mines” in your configuration. We’re starting another series this week on device files in Linux. Specifically, we’re going to look at the /dev directory as it exists today and the transition that’s underway in the way your system references and addresses devices.

As with any operating system, it’s important that the core code can communicate with hardware devices. In Linux, this communication takes place via device files, a somewhat mis-named set of references to devices. Device files really serve as the conduit between the Linux kernel and the I/O (input/output) subsystem of your Linux system. In a way, these device files serve as an abstraction of the devices themselves. It’s much like the word “car.” The word itself is not the device, but merely a symbolic representation of the physical entity. These device abstractions provide a way to access the devices they represent without requiring a complete understanding of the device itself. The word “represent” is important – these device files merely provide a communicable representation of the devices.

Currently, these device “conduits” are located in a special directory in Linux – the /dev directory. You’ll know from our series on Linux directories that /dev resides at the top level of the / directory. A quick ls on the /dev directory will reveal a full list of seemingly incongruent and confusing names. These files, as already noted, represent all current and potential devices on your system, providing a means for your I/O requests to communicate with the kernel code.

Device references in Linux are currently in transition. The DevFS system promises to simplify the somewhat confusing /dev system. Most current distributions offer the option to utilize DevFS during installation, while continuing to retain the /dev structure by default. We’ll talk about the advantages of DevFS toward the end of this series.

So, that’s the high level. Device files in Linux are actually hardware abstractions. While they can be read and written to, they’re really not files. Instead, they can be considered as conduits between the hardware and the kernel. The current /dev system will, within the next few years, disappear altogether in favor of a more logical and efficient system called DevFS.

Tomorrow, we’ll look at the general naming convention for these device conduits.

Article Written by