The /dev directory in Linux
Find out what devices are connected to your system
Everything in Linux is a file, and that is true for devices as well.
All devices connected to a Linux system are represented by a device file inside the dev directory. The directory’s name is short for “devices”, and can be found attached to the root filesystem.
There are many types of devices that can connect to a Linux system, but by far the most encountered are:
- Character Devices
- Block Devices
This article is intended at giving you a grasp of what these devices are, and how to identify them.
Character Devices
The simplest type of communication between devices in Linux is by sending individual bytes of data to the target device.
Usually, a group of 8 bits, besides being called a byte, is also called a character. By this convention, all devices that support receiving and sending streams of bytes are called character devices.
Examples of character devices are sound cards, mice, and keyboards.
Block Devices
Another way of communicating with a device is by sending and receiving blocks of bytes (or characters) in a…