Skip to content
Related Articles

Related Articles

Device Drivers in Linux
  • Last Updated : 25 Jan, 2021

Drivers are used to help the hardware devices interact with the operating system. In windows, all the devices and drivers are grouped together in a single console called device manager. In Linux, even the hardware devices are treated like ordinary files, which makes it easier for the software to interact with the device drivers. When a device is connected to the system, a device file is created in /dev directory. 

Most Common types of devices in Linux:

  1. Character devices – These devices transmit the data character by characters, like a mouse or a keyboard.
  2. Block devices – These devices transfer unit of data storage called a block, USB drives, hard drives, and CD ROMs

To list all the device files use the below command.

ls -l /dev

listing drivers in linux

In the above output, we can see some other types of file types, some of them have B for a block device, C for character device some devices start with /dev/sda or /sdb. In Linux, the disk names are alphabetical. For example, dev/sda is the first hard drive, dev/sdb is the second hard drive, and so on. These devices are mass storage devices like memory sticks, hard drives, etc. Hence, sda means that this device was detected by the computer first. Example of character device is : /dev/consoles or /dev/ttyS0. These devices are accessed as a stream of bytes. Example of block device: /dev/sdxn. Block devices allow the programmer to read and write any size of the block. Pseudo devices act as device drivers without an actual device. Examples of pseudo devices are /dev/null, /dev/zero, /dev/pf etc.



Disk and Driver Commands

 1. fdisk – It stands for format disk. This command is used to display the partitions on a disk and other details related to the file system.

sudo fdisk -l

fdisk -l

2. sfdisk – This command displays the partitions on the disk, the size of each partition in MB, etc.

3. parted – This command helps list and modify the partitions of the disk.

sudo parted -l

parted command in linux

4. df – Displays the details of the file system. Using grep we can filter real hard disk files.

df -h | grep ^/dev

5. lsblk – List details about the block devices.

lsblk

6. inxi – Lists details about the hardware components in the file system.

inxi -D -xx

The kernel is a monolithic piece of software, but it is also responsible to provide support to the hardware. Most of the devices have built-in kernel modules, so when they are plugged in, they start working automatically.

My Personal Notes arrow_drop_up
Recommended Articles
Page :