Linux - Check Disk Space in MB (Megabyte) GB (Gigabyte) Form

Linux - Check Disk Space in MB (Megabyte) GB (Gigabyte) Form

  • Linux
  • 2 mins read

In Linux, the df command is used to check disk space available on an individual device. But if you will use the df command without any parameter, it will show you used and available disk space in bytes. For better readability, to check the disk space in MB (Megabyte) and in GB (Gigabyte) form, use -h option. Below is an example:

Linux - Check Disk Space in Bytes

$ df

Output

Filesystem     1K-blocks     Used Available Use% Mounted on
udev             1012760        0   1012760   0% /dev
tmpfs             206252     3740    202512   2% /run
/dev/sda1       29799484  4494956  23767760  16% /
tmpfs            1031244      172   1031072   1% /dev/shm
tmpfs               5120        4      5116   1% /run/lock
tmpfs            1031244        0   1031244   0% /sys/fs/cgroup
linux          479230972 85128384 394102588  18% /media/sf_linux
ubuntu         479230972 85128384 394102588  18% /media/sf_ubuntu
tmpfs             206252       56    206196   1% /run/user/1000
/dev/sr0           57064    57064         0 100% /media/vin/VBox_GAs_5.2.26

Linux - Check Disk Space in MB (Megabyte), GB (Gigabyte) Form

$ df -h

Output

Filesystem      Size  Used Avail Use% Mounted on
udev            990M     0  990M   0% /dev
tmpfs           202M  3.7M  198M   2% /run
/dev/sda1        29G  4.3G   23G  16% /
tmpfs          1008M  172K 1007M   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs          1008M     0 1008M   0% /sys/fs/cgroup
linux           458G   82G  376G  18% /media/sf_linux
ubuntu          458G   82G  376G  18% /media/sf_ubuntu
tmpfs           202M   56K  202M   1% /run/user/1000
/dev/sr0         56M   56M     0 100% /media/vin/VBox_GAs_5.2.26

Now instead of big block numbers, the disk sizes are displayed in a human readable form in MB and GB form.

See also: