How to check total space and available space in Linux using the terminal?

LinuxOperating SystemOpen Source

In the Linux/Unix system to check storage details, we use the df command.

df (disk free) command 

the df command is used to report file system disk space usage using the terminal in the Linux system. It displays total space, used space, and available space.

Syntax

The general syntax of the df command is as follow:

$ df [OPTION]... [FILE]...

Brief description of options available in the df command.

Sr.No.
Option & Description
1
-a, --all
Include duplicate, pseudo, inaccessible file systems
2
-B, --block-size=SIZE
Scale sizes before printing
3
-h, --human-readable
Display sizes in powers of 1024
4
-H, --si
Display sizes in powers of 1000
5
-l, --local
Limit listing to local file systems
6
--no-sync
Don’t synchronize before getting usage info
7
--sync
Synchronize before getting usage info
8
-T, --print-type
Display file system type
9
-x, --exclude-type=TYPE
Limit listing to the file systems not of specified type
10
--help
Displays a help message and then exits.
11
--version
It gives info about the version and then exits.

To check space usage, we use the df command. By default, it is hard to understand the output of the df command.

$ df

The below snapshot is the output screen after the execution of the df command in the Linux system.

We can see that /dev/sda5 (root partition) 9736500 have total size 5813352 have used size and 3408844 have available size but what are these numbers? These numbers don’t have any units so we can’t understand.

Make it human readable there is an option available -h or --human-readable that makes it readable.

To display output in human readable format, we use -h or --human-readable option with the df command as shown in below.

$ df --human-readable

Or

$ df -h

After executing above command, it reports the disk space usage in human readable form then we can easily understand disk space usage.

Display storage details in powers of 1000 (e.g., 32.3G).

To display output in powers of 1000, we use -H or --si option with the df command in the Linux system using terminal

$ df --si

Or

$ df -H

After executing above command, it reports the disk space usage in powers of 1000. Now we can easily understand disk space usage because we are more familiar with GB.

For more details about df command and check option description use below command.

$ df --help

And check the version information of df command use below command.

$ df --version
raja
Published on 30-Jun-2021 10:36:35
Advertisements