Learn to check a Disk Space in Linux by using ‘df’ command
In this article we are learning how to check a Disk Space in Linux operating system.On the internet you will find plenty of tools for checking disk space utilization in Linux. In the Linux operating system , Linux has a strong built in utility called ‘df’. The ‘df’ command stand for “disk filesystem”, it is used to get full summary of available and used disk space usage of file system on Linux system.
Using ‘-h’ parameter with (df -h) will shows the file system disk space statistics in “human readable” format, means it gives the details in bytes, mega bytes and gigabyte.
Syntax - #df -option
1. Check File System Disk Space Usage
The “df” command displays the information of device name, total blocks, total disk space, used disk space, available disk space and mount points on a file system.
2. Show Disk Space Usage in Human Readable Format
Have you noticed that above commands displays information in bytes, which is not readable yet all, because we are in a habit of reading the sizes in megabytes, gigabytes etc. as it makes very easy to understand and remember.
The df command provides an option to display sizes in Human Readable formats by using ‘-h’ (prints the results in human readable format (e.g., 1K 2M 3G)).
3. Display Information of all File System Disk Space Usage
The same as above, but it also displays information of dummy file systems along with all the file system disk usage and their memory utilization.
4. Display Information of /home File System
To see the information of only device /home file system in human readable format use the following command.
#df -hT /home
5. Display Information of File System in Bytes
To display all file system information and usage in 1024-byte blocks, use the option ‘-k‘
(e.g. –block-size=1K) as follows.
6. Display Information of File System in MB
To display information of all file system usage in MB (Mega Byte) use the option as ‘-m’.
7. Display Information of File System in GB
To display information of all file system statistics in GB (Gigabyte) use the option as ‘df -h’.
8. Display File System Inodes
Using ‘-i’ switch will display the information of number of used inodes and their percentage for the file system.
9. Display File System Type
If you notice all the above commands output, you will see there is no file system type mentioned in the results. To check the file system type of your system use the option ‘T’. It will display file system type along with other information.
10. Display Information of df Command
Using ‘–help’ switch will display a list of available option that are used with df command.