In my previous articles, I have already covered two different Linux commands used for monitoring the disk usage statistics in your Linux systems, that are- 'df' Command and 'du' Command. If you have not read these articles, you can read it now:
- Check the Disk Space Usage in Your Linux System Using 'df' Command
- Monitor and Analyze the Disk Usage Stats with Linux Command: "DU"
In this article, we will see a new command 'di' that has the same function as that of 'df' command and 'du' command along with some advanced features. 'di' stands for 'Disk Information' and it has all the features supported by the well-known 'df' command, hence can be considered as an alternative for 'df' command. If you observe and compare outputs of 'df'' command and 'di' command, you will find that there is an extra column of 'Total Size' of the file system in the 'di' command output. So, without much a do, lets jump to the tutorial part of this article.
Here we go!
1. Basic Usage of 'di' Command
When 'di' command is executed without any options and arguments, it will produce an output which is easily understandable by a human being. It uses notations like 'G' for gigabytes and 'M' for megabytes. It is definitely better that the 'df' output which displays the disk space usage in terms of number of data blocks occupied.
2. Displaying All FieldsWhen di command is used with option -A, it displays mount points and special devices names at full width.
|Result: di -A|
3. Displaying All Mounted DevicesWhen 'di' command is executed with option -a, it displays information about all the currently mounted devices.
|Result: di -a|
4. Displaying the Comma Separated ValuesWhen 'di' command is used with option -c, it prints the output with comma separated values.
|Result: di -c|
5. Display Usage in Gigabytes, Megabytes and KilobytesIf you run 'di' command with options -g, -m and -k, you will get disk usage information in Gigabytes, Megabytes and Kilobytes in the output respectively.
di -g di -m di -k
|Result: di -g, di -m, di -k|
6. Print the Information Specific to a Particular File SystemWhen you wish to observe disk space usage stats related to a specific file system, you can use 'di' command with option -I and file system type as an argument.
di -I [FILE SYSTEM]
di -I ext4
|Result: di -I ext4|
7. Do Not Print the HeaderWhen you are parsing the 'di' output, you may not want to print the header line in the output. This can be achieved by executing 'di' command with option -n.
|Result: di -n|
8. Displaying the Total UsageYou can add an extra line in the 'di' output specifying the total disk space usage information by using option -t.
|Result: di -t|
That's all. You can always refer to manual page of 'di' command by entering man di in the terminal. For any feedback, use the comment section below and stay tuned for more articles on Linux Commands.