Howto Find Out or Learn Harddisk Size in Linux or UNIX

September 8, 2019

Rate this post

How do I find out my installed hard disk size in Linux or UNIX like operating systems?

Under Linux and UNIX operating systems you can use the df command. The df command displays the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted file systems is shown.

Task: Display Hard Disk Partition Size

Open a command-line terminal (select Applications > Accessories > Terminal), and then type:
$ df
Sample outputs:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hdb1             19228276  14699744   3551784  81% /
tmpfs                   384300         4    384296   1% /dev/shm
/dev/hdb5             27917308  23883184   2615988  91% /data/network

Task: Display Hard Disk Partition Size in Mega bytes or GB or TB

Type the following command:
$ df -H
Sample outputs:

Filesystem             Size   Used  Avail Use% Mounted on
/dev/hdb1               20G    16G   3.7G  81% /
tmpfs                  394M   4.1k   394M   1% /dev/shm
/dev/hdb5               29G    25G   2.7G  91% /data/network

Task: Display TOTAL Hard Disk Size

The fdisk command is partition table manipulator for Linux. But it can be used to display total hard disk size. You must type the following command as the root user:
# fdisk -l | grep Disk
Sample outputs:

Disk /dev/hda: 20.0 GB, 20060651520 bytes
Disk /dev/hdb: 80.0 GB, 80060424192 bytes

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.