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:
- Character devices - These devices transmit the data character by characters, like a mouse or a keyboard.
- 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
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
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
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.
Similar Reads
Interesting Facts about Linux Linux is community-developed and open source operating system for computers, servers, mainframes, embedded devices, and mobile devices. It is supported on nearly every major computer platforms including SPARC, ARM and, x86 building it as one of the most extensively supported operating systems. Here
2 min read
Linux Kernel Linux Kernel is the heart of Linux operating systems. It is an open-source (source code that can be used by anyone freely) software that is most popular and widely used in the industry as well as on a personal use basis. Who created Linux and why? Linux was created by Linus Torvalds in 1991 as a hob
4 min read
Embedded Linux for IoT Systems Linux is a potent, open-source operating system based on Unix and capable of functioning on a variety of hardware with heavy operating demands. Earlier Linux was just an operating system, but over time, it has become one the best operating systems that support running desktops, embedded devices, and
5 min read
How to Mount and Unmount Drives on Linux In the Linux operating system, everything is treated as a file. Every Linux administrator must know how to organize and access files better. In this article, we will learn about the Mount and Unmount commands.What are mounting and unmounting in Linux?Mounting and Unmounting are essential tasks in an
4 min read
Best Android Emulator for Kali Linux An Android emulator assists developers and testers in analyzing their applications without the need for a physical device. An Android emulator is an application that creates a virtual environment on a different platform. An Android emulator can simulate the browser, operating system, software, hardw
10 min read