Linux command to list drives – Introduction
Looking for Linux command to list drives? Then why wait any longer
Let’s dig in!
In Linux, a “driver” refers to a software component that enables communication between the operating system and a specific hardware device. Linux supports a wide range of hardware devices, and the kernel includes many built-in drivers. These drivers are responsible for managing and controlling the functionality of various hardware components.
The hard disk is the main component of the system to store the data permanently. We can install single or multiple disks for data storage and several commands are utilized to list your computer’s disk and partition of disk details.
Here are some commands to list drivers, shown below.
Using the df command
To verify the amount of free disc space, use the df (disc free) command. It may be used to display a list of the discs’ file systems. Let’s use the df command to see what happens.
$ sudo df
The output displays the file systems, together with discs and partitions, and additional pertinent data.
To list the drivers and their disk space usage, you can use the df command with the -h option to display the sizes in a more human-readable format. Here’s the command:
df –h
Running this command will provide you with a list of mounted file systems along with their total size, used space, available space, and the mount point for each driver
Using the lsblk Commands
On Linux systems, block device information is listed using the lsblk command. Information regarding discs, partitions, and their connections are displayed. Here’s an illustration of how to list drivers using lsblk:
Just type on terminal:
Lsblk
This command will provide a hierarchical representation of all accessible block devices together with information about their names, dimensions, and connections. The final product will resemble this.
List Disks Using cfdisk Command
Given that it is entirely visual and interactive, cfdisk is perhaps the GUI (Graphical User Interface) that is the most sophisticated. It first enables you to view all of your system’s discs and partitions, but it also enables you to handle them by choosing them and then carrying out operations like “Delete,” “Resize,” “Type” (to alter the type of the partition), and “Write” changes made to partitions.
$ sudo cfdisk
Additionally, it provides you with highly user-friendly information about every partition and disc by showing you the complete size of each one along with its kind, the beginning and ending points of each partition’s cylinders, and the number of sectors each one uses.
List Driver Using fdisk Command
The disc partitions in the system hardware can be created or altered using the fdisk (format disc) command. With the “l” (list) option of the fdisk command, we may list the number of discs present on the system:
$ sudo fdisk –l
Various details of the disc and partitions, including the disc and its partitions, are displayed in the output.
List Drivers Using sfdisk Command
Sfdisk performs operations fairly similarly to fdisk, but it also provides a “summary” of the partitions of the physical volumes, including the cylinders (start and finish), sectors, size, and type. It
also allows you to view both physical and logical volumes.
$ sudo sfdisk –l
The output displays a number of file system details, including a list of the disc’s details and its partitions.
Using parted command
As its name indicates, the parted software is a strong tool for managing your partitions, but when used with the -l option, it displays a list of partition layouts for all block devices.
sudo parted –l
Using lshw Command
The Linux system hardware configuration is reported using the lshw (list hardware) command. To see the system discs details as described below, we may use the lshw command with the “class” option and “disc” value.
$ sudo lshw -class disk
The result displays the partitions on the system’s available disc.
Using the hwinfo command, list drivers
“hwinfo” hard disc info) is another command to inspect the system’s physical discs. It is frequently used to examine the system’s hard facts. We may use the “disc” argument with the hwinfo comm
and to explicitly list the disc details.
$ sudo hwinfo –disk
The output includes a number of information on the disc, including its specific ID, model, disc-mounted file system, etc.
List Disks using /dev/disk file
By default, the Linux operating system keeps disc information in the “/dev/disk” file. To list all the information about the discs and disc partitions, we may use the “ls” command with the “/dev/disk” device. As demonstrated below, we can use the “partuuid” option to sort the “/dev/disk” file in order to list the partition details.
$ ls -l /dev/disk/by-partuuid
The report indicates that the system has three partitions: “sda1,” “sd2,” and “sda3.” The following parameters can be used to sort the “/dev/disk” file as well:
by-id
by-label
by-path
by-partlabel
by-uuid
Final Thoughts
Now you know Linux command to list drives but Linux has several tools for listing discs, including lsblk, df, cfdisk, lshw, fdisk, hwinfo, and sfdisk. The information that these commands output about each disc (and partition, if appropriate), varies from basic to advanced. These commands to list discs on Linux have all been simply discussed in this text.
You can learn about linux more deeply by clicking the link below
https://linuxiron.com/what-is-linux-a-whole-introduction/
Learn about the other linux commands by clicking the links below
https://linuxiron.com/echo-command-in-linux/
https://linuxiron.com/how-to-use-nice-renice-commands-in-linux/
https://linuxiron.com/how-to-use-kill-commands-in-linux/
https://linuxiron.com/a-beginners-guide-to-htop-for-process-management/
https://linuxiron.com/15-useful-yum-commands-in-linux/
https://linuxiron.com/how-to-use-the-top-command-in-linux/
https://linuxiron.com/17-ps-command-to-monitor-linux-process-with-examples-linuxiron/
https://linuxiron.com/12-cat-commands-in-linux-with-examples/
https://linuxiron.com/archiving-and-compressing-files-and-directories-in-linux/