To find out the size of a hard disk on a Linux or Unix-like system, you can use the fdisk
command to display the partition table for the disk, and the df
command to display the usage and capacity of the file systems on the disk.
fdisk
command to display the partition table for the disk. For example, to display the partition table for the /dev/sda
disk, you can use the following command:fdisk -l /dev/sda
This will display the partition table for the /dev/sda
disk, including the size of each partition.
df
command to display the usage and capacity of the file systems on the disk. For example, to display the usage and capacity of all file systems on the system, you can use the following command:df -h
This will display the file system type, mount point, usage, and capacity of all file systems on the system, in human-readable format.
To display the usage and capacity of a specific file system, you can specify the file system or mount point as an argument. For example, to display the usage and capacity of the /
file system, you can use the following command:
df -h /
This will display the usage and capacity of the /
file system.
You can find more information about the fdisk
and df
commands and their options in the fdisk
and df
documentation or by running the fdisk --help
and df --help
commands.