How to visualize disk usage on Linux

They say a picture is worth a thousand words. This age-old saying applies to disk usage as well. As your Linux system becomes old, chances are that you start to run out of the disk space. Visualizing disk usage can help you in this case with understanding how the overall disk space is being used, so you can be better prepared to clean it up.

In this tutorial, I describe how to visualize disk usage on Linux.

Baobab is a GNOME disk usage analyzer. Its biggest advantage is the intuitive visualization interface. Baobab can analyze the whole file system tree, a particular directory tree or even remote folders over network.

Install Baobab Visual Disk Space Analyzer on Linux

To install Baobab on Debian, Ubuntu or Linux Mint:

$ sudo apt-get install baobab

To install Baobab on Fedora, CentOS or RHEL:

$ sudo yum install baobab

Visualize Disk Usage with Baobab

For disk usage visualization, launch Baobab as follows.

$ baobab <path to the directory to analyze>

Baobab reports the result of disk usage analysis in two panels: per-directory disk utilization stats are reported in numbers in the left panel, and the overall disk utilization is visualized in the right panel. Note that Baobab does not consider /proc or any other non-plain files such as symlinks, block devices, etc.

Baobab supports the following two different visualization methods.

Ring Charts

In the ring chart, multiple concentric circles indicate directories in the directory tree, and the center of the circles corresponds to the root of the directory tree. The smaller a circle is, the higher a corresponding directory ranks in the directory hierarchy. If you hover a mouse on any particular directory, it will show the names of its sub-directories on the immediate outer circle. You can tell the relative sizes of the sub-directories by comparing their sizes in a ring-shaped area.

Treemap Charts

Another visualization mode of Baobap is treemap charts, where overlapping rectangles are used to visualize the hierarchical structure of directories. In this case, the outermost rectangle corresponds to the root of the directory tree, and the inner rectangles to sub-directories. The size of each rectangle indicates the size of a corresponding sub-directory. You can hover a mouse to check the name of a sub-directory.

Visualize Disk Usage of Remote Disks

Baobab can analyze local folders as well as remote folders. To examine remote folders, click on "Scan a Remote Folder" button. Baobap supports SSH, FTP, WebDAV and Windows Share.

Nautilus Integration

Once Baobab is installed on Ubuntu, you can use Baobab's visual disk usage analyzer within Nautilus file manager. Simply right-click a particular folder on Nautilus, and choose "Open with Disk Usage Analyzer" menu. Baobab works only on folders, not on individual files.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

15 thoughts on “How to visualize disk usage on Linux

  1. At first I was wondering why you'd need this as KDE already includes such functionality... then I read the article. Ubuntu centric.

  2. Baobab is a nice tool, easy to use. Unfortunately, unless things changed recently, baobab doesn't have an option to not include mount points, and this makes it unusable for me.
    For example, if you are under pressure to check /home because the partition is almost full, baobab will waste precious time analysing descending into Fuse (SSHFS for example) mount point in users' home directories. Likewise, analysing "/" is not as straightforward as it should be.
    In this regard, filelight is much better, and is usually the only Qt application I have with my Gtk-centric setups.

  3. Unfortunately, I could not make it to install on my CentOS 5 box. The package is not found. Here is the output of yum.

    # yum install baobab
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * rpmforge: mirror-fpt-telecom.fpt.net
    * extras: mirror-fpt-telecom.fpt.net
    * updates: mirror.nbrc.ac.in
    * base: mirror-fpt-telecom.fpt.net
    * addons: mirror.nbrc.ac.in
    Setting up Install Process
    Parsing package install arguments
    No package baobab available.
    Nothing to do
    #

    Any ideas?

Leave a comment

Your email address will not be published. Required fields are marked *

Current day month ye@r *