It does not matter whether you are a Linux user or administrator, most of the times you have to look after your file system and should manage it frequently. And it has been seen that there will be always a scramble for space after adding disks to system. So disk free in short df is a disk management command in UNIX like operating system. So now let us discuss briefly what is df command and how it is helpful to manage your disk.
What is df command ?
Being a UNIX/Linux user you must be knowing that your operating system supported by multiple files systems. And to see report that how much space is consumed and available for each file system separately we use df (disk free) command.
The general syntax for the this command is as below:
df [OPTIONS]... FILESYSTEM...
Now let us see when you use df command without any argument.
$ df output
Now you can see after invoking df command without any argument its showing the information about your filesystem, Blocks, Used, Available, Mounted on etc. The default output is very informative, it shows the total as well the available space.
And suppose you want to get information about a particular directory, you can run the below command. For example i have obtained the statistics for the
You can invoke disk free command with the below argument to get more and required information. I have discussed few important and most used options.
|-a (all)||includes pseudo, duplicate, inaccessible file systems|
|-h (human-readable)||prints sizes in powers of 1024 (e.g., 1023M)|
|-i (inode number)||list inode information instead of block usage|
|-t (type)||limit listing to file systems of type TYPE|
|-h||prints sizes in powers of 1000 (e.g., 1.1G)|
Here i will discuss about (-h) option and why its used as it is mostly used with disk free command and very much important while analyzing your file system.
Show Disk Space Usage in Human Readable Format !
By default, the
df command shows the disk space in 1k-blocks as shown above while invoking without any option and the size of used and available disk space in kilobytes which is sometimes very difficult for large files to analyze quickly.
To display information about disk drives in human-readable format (like in –kilobytes, megabytes, gigabytes and so on), we invoke this command with -h option.
$ df -h Output
Imp: Remember when the space in one file system is consumed fully , the file system can not borrow space from another file system.
In this tutorial we have discussed about how to use the df command to get a report of your file-system. To view all available information about df command and its options by typing man df your terminal. As you must have understood df and du are disk management commands both with different act. Check out du command and how both the commands are different.