Introduction to Linux - A Hands on Guide | Linux Bible | Linux From Scratch | A Newbie's Getting Started Guide to Linux | Linux Command Line Cheat Sheet | More Linux eBooks

Thursday, 24 October 2013

Check Disk Usage Stats For File Systems with 'di' Command in Ubuntu Linux

    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:
    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.




Result: di

2. Displaying All Fields

When di command is used with option -A, it displays mount points and special devices names at full width.


di -A


Result: di -A

3. Displaying All Mounted Devices

When 'di' command is executed with option -a, it displays information about all the currently mounted devices.


di -a


Result: di -a

4. Displaying the Comma Separated Values

When 'di' command is used with option -c, it prints the output with comma separated values.


di -c


Result: di -c

5. Display Usage in Gigabytes, Megabytes and Kilobytes

If 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 System

When 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 ext4


Result: di -I ext4

7. Do Not Print the Header

When 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.


di -n


Result: di -n

8. Displaying the Total Usage

You can add an extra line in the 'di' output specifying the total disk space usage information by using option -t.


di -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.


  1. di is not on suse, mint, or mandriva/mageia systems and it's not documented in
    Where do you found it? It's only for ubuntu, so you can't say it's a linux command...


    1. Truly said..
      Corrected now..
      Thank you..

  2. di is *not* exclusive to Ubuntu. It just happens to be built into the standard set of utilities. di can be installed on a variety of distros. I'm using arch and it's available from the extra's repo.