6 Ways to Check Disk Usage in Linux

By default, all Linux distributions have been bundled with a tool to handle the task of checking the disk usage. From CLI-based tools to GUI-based ones. While seasoned Linux users commonly tend to prefer using CLI-based tools, new comers to Linux usually feel more comfortable to use GUI-based tools.

In addition to the default tools offered by your distro, you can also use other tools developed by third parties in case you find the default tools offered by your distro are hard enough to use. Or simply, you want to compare the results of different tools, may be.

No matter what kind of tool you choose, here are 6 ways to check the disk usage in Linux.

1. Using df

The first way to check disk usage in Linux by using df. Df is the standard tool of the Linux system and nearly all Linux distribution have been bundled with this tool. Df will display the amount of disk space available on your file system containing each file name argument. You can use this tool by simply typing “df” on terminal, without having to be a root. However, you may will meet some problems to understand the outputs since it will display the numbers in byte.

In order to get a more understandable outputs you can use the “-h” option. The option of “h” will display the file and folder sizes in a format you can read. When you execute the following command on terminal,

$ df -h

you will get the following outputs.

To see more options you can use on df,you can type the following command.

$ df --help

2. Using ncdu

Another CLI-based tool you can use to check the disk usage in Linux is ncdu. Unlike dfncdu is not installed in most Linux distributions by default. If you use a Debian-based distro, you can install this tool by typing the following command (I use Ubuntu in this case).

$ sudo apt install ncdu

If you run ncdu without any option, it will scan the contents of the Home directory of your account and displays the total contents along with disk usage.

You can also use ndcu to check the total size of a certain directory and how many files inside it by simply typing the path of the directory you want to check. For instance, you may want to check what is the current total size of the Pictures folder.

$ ncdu Pictures

Just like other commands in Linux, ncdu also comes with a number of options you can use. To see all options, type the following command.

$ ncdu -h

3. Using the “properties” option of your file manager

No matter the file manager you use, you can take advantage of its “properties” feature to check the disk usage on your Linux system. Nearly all file managers in Linux have had this feature. Just right-click a certain folder in the file manager you use and click the “properties” option. Below are the look of “properties” on Thunar and Nautilus.

4. Using Baobab

Disk Usage Analyzer or also known as Baobab is the GUI-based disk analyzer tool part of GNOME project. This tool is a good choice for new Linux users who curious about the detail statistic of their disk. At the beginning display of this tool you will see the total capacity of the disk on your system, along with the current usage.

You can either scan the entire disk on your system or your Home directory. Once you click one of them, you will see a more detailed statistics in a colorful interface. Each color represents the existing folder in your system. Clicking one of the color meaning that you get into a folder on your system in which probably contains other folders. An so on and so on. To see the total size of certain folder (along with contained sub folders), just hover your mouse over a certain color.

5. Using xdiskusage

Xdiskusage is another GUI-based disk analyzer. By default, this tool is not installed in most Linux distributions so you need to install it in advance before being to use it. In Debian-based distros, you can install this app by typing the following command.

$ sudo apt install xdiskusage

Disk Usage will display the results in a tree-based presentation. The parent directory block is displayed on the left-most, followed by child directories off to the right. Double-clicking a certain block/directory meaning that you get into that directory in which probably contains other directories (just like in Baobab). To start scanning, enter the full path of the directory you want to analyze and hit enter.

Well, xdiskusage is probably has no fancy look as Baobab, but it’s pretty useful and, most importantly, lighter.

6. Using duc

Duc is a combination between CLI-based tool and GUI-based tool. You can set this tool to display the CLI-based outputs, but GUI-based interface is also available if you love the visual presentation. The visual presentation of this tool is quite similar to Baobab. By default, duc isn’t installed in most Linux distributions. In Debian-based distros you can install this tool by executing the following command.

$ sudo apt install duc

The use of duc is a bit more complex than other tools on this list. Firstly, you need create an index of the directory you want to scan. For instance, if you want to check the disk usage of your Home directory (“cap” in this case), you need to execute the following command first.

$ duc index /home/cap/

To display the disk usage of the directory you have indexed in CLI-based output, you can type the following command.

$ duc ls -Fg /home/cap

Or, if you want to display the disk usage of the directory you have indexed in GUI-based output, you can type the following command.

$ duc gui /home/cap

Same as Baobab, each color in duc also represents the existing folder name on your system. To get into each folder just click the your preferred folder. Click on the middle of the chart (the white color) to return to the upper folder.

Related posts

Written by Al Putra

An open source user, Manchester United fan and CC0-licensed stuffs lover