You can get disk information on Linux using various commands. Here are a few commonly used ones:
- df command: This command provides information about disk space usage for each file system. It displays the total disk space, used space, available space, and the file system type for each mounted partition. For example, to display disk information for all partitions, you can use the command:
- fdisk command: This command is used to view, create, resize, and delete partitions on a hard disk. It provides detailed information about the partitions on a specific disk. For example, to view disk information for the first hard disk on your system, you can use the command:
fdisk -l /dev/sda
- lsblk command: This command lists information about all available block devices, including disks and their respective partitions. It displays details such as device name, size, type, mountpoints, and more. For example, to view disk information using lsblk, you can use the following command:
- smartctl command: This command allows you to monitor and query various attributes of storage devices such as hard drives and SSDs. It provides detailed information about the disk's health status, temperature, firmware version, and more. For example, to display basic information about a drive, you can use the command:
smartctl -a /dev/sda
These are just a few examples of commands that can be used to obtain disk information on Linux. There are other tools available as well, depending on your specific requirements and distribution.