Qdirstat / Guides / Linux

Qdirstat Linux Guide: Installing and Using It on Any Distribution

By the Qdirstat Guides TeamUpdated 3 December 20267 min read
Compact Linux workstation beside an external solid-state drive

Qdirstat scans Linux directories and shows their contents in a tree and treemap. It runs on a Qt desktop stack and can use package information where the distribution supports it. The installation route varies by distribution.

This article covers package installation, desktop launchers and the directories that often account for unexpected growth. It also explains how to safely inspect a server without connecting a graphical desktop directly to it.

This Qdirstat Linux guide gathers installation commands for the major distributions, explains how Qdirstat behaves under X11 and Wayland, describes the Linux directories most worth examining and outlines an efficient everyday workflow.

Why Qdirstat Suits Linux So Well

Linux spreads data across a well-defined hierarchy: user files in /home, variable data in /var, installed software in /usr, optional software in /opt and temporary files in /tmp. Problems usually concentrate in one or two of these branches, and Qdirstat’s sorted tree points to them immediately.

Qdirstat also understands Linux-specific details. It recognises mount points and, by default, stays within the filesystem you start from, which prevents a scan of / from wandering into /proc, external drives or network shares. It can read package databases from dpkg, rpm and pacman, and it reports hard links, symbolic links and sparse files correctly.

DistributionCommand
Debian, Ubuntu, Linux Mint, Pop!_OSsudo apt install qdirstat
Fedorasudo dnf install qdirstat
openSUSE Leap and Tumbleweedsudo zypper install qdirstat
Arch, EndeavourOS, Manjaroyay -S qdirstat (AUR)
GNU Guixguix install qdirstat
Other distributionsBuild from the source ZIP with Qt

For RHEL-compatible systems such as AlmaLinux or Rocky Linux, Qdirstat may be available through the EPEL repository. Enable EPEL first and then install with dnf. The openSUSE Build Service also publishes current Qdirstat builds for several distributions, maintained by the Qdirstat developer.

Building Qdirstat from Source on Any Distribution

If no package exists for your system, building Qdirstat is straightforward. Install a C++ compiler, make, the Qt 6 development files (base and the Qt 5 compatibility module) and zlib headers, then:

unzip qdirstat-master.zip
cd qdirstat-master
qmake6
make -j"$(nproc)"
sudo make install

On distributions where the Qt 6 qmake is simply called qmake, use that name instead.

Desktop Integration on Linux

GNOME, KDE Plasma, Xfce and Others

Qdirstat installs a desktop entry, so it appears in the application menu of every major desktop. On KDE Plasma it blends in naturally because both use Qt. On GNOME and other GTK-based desktops, Qdirstat uses a neutral Qt style that looks clean; you can install a Qt platform theme such as qt6ct if you want closer visual matching.

X11 and Wayland

Running Qdirstat as your normal user works on both X11 and Wayland. Differences appear when you run it as root. Under X11, sudo -E qdirstat generally works. Under Wayland, applications launched as root often cannot reach your display session; you can use XWayland with temporary permission through xhost +si:localuser:root, or scan system directories in a separate root session. Many users find it simplest to scan as root only occasionally and handle everyday analysis as a normal user.

File Manager Integration

Qdirstat cleanup actions can open your preferred file manager or terminal in the selected location. In the settings, adjust the commands to match your desktop, for example nautilus, dolphin, thunar or nemo, and your terminal emulator of choice.

Linux Directories Worth Scanning Regularly

~/.cache

Browsers, thumbnail generators, package managers and development tools store caches here. It is common to find several gigabytes in this folder, most of which can be cleared safely while the related applications are closed.

~/.local/share

This directory contains application data, including Flatpak user installations, Steam libraries, game saves, trash contents and virtual machine images. Inspect it carefully, because some content here is valuable.

/var/log and /var/log/journal

Log growth often indicates a misbehaving service. Qdirstat reveals large logs, but fix the underlying cause and trim logs with the appropriate tools such as journalctl --vacuum-size or logrotate configuration.

/var/lib

Container engines, databases, snap and Flatpak system installations live here. Use their own management commands to clean up, guided by what Qdirstat shows.

/opt and /usr/local

Software installed outside the package manager usually ends up here. Qdirstat’s unpackaged files view is ideal for reviewing these locations.

An Efficient Qdirstat Workflow on Linux

  1. Start narrow. Scan the directory you suspect rather than the entire root filesystem. Narrow scans finish faster and use less memory.
  2. Read the tree first. Sort by size and expand the largest branch two or three levels deep.
  3. Use the treemap for patterns. Look for large single-colour blocks, which indicate big files of one type, and for dense mosaics, which indicate many small files.
  4. Consult the Discover menu. Check the largest files and the oldest files lists; together they often reveal forgotten downloads and archives.
  5. Act carefully. Prefer “Move to Trash” for personal data, and use package managers or dedicated tools for system data.
  6. Refresh the branch. After cleaning, refresh only the affected directory instead of rescanning everything.

Qdirstat on Linux Servers

Servers often have no graphical environment. Qdirstat offers two elegant solutions. The first is the qdirstat-cache-writer Perl script, which scans a directory on the server and writes a compressed cache file. Copy that file to your desktop and open it in Qdirstat with “Read Cache File” to explore the server’s disk usage visually. The second is a community Docker image, which runs Qdirstat inside a container and serves its interface to your web browser.

For quick checks directly on a server, terminal tools such as du and ncdu remain handy, but Qdirstat’s treemap provides context they cannot match, especially when presenting findings to colleagues.

Linux Details Qdirstat Reveals That Other Tools Hide

Hard Links

On Linux, one file can have several names through hard links. Backup tools such as rsnapshot and some package managers use them heavily. A naive tool counts the same data several times, inflating totals. Qdirstat recognises files with multiple hard links and its Discover menu can list them, helping you understand why the space reported by a scan and the space used on disk sometimes differ.

Sparse Files

Virtual machine disks, database files and some downloads are created as sparse files, whose apparent size is much larger than the blocks actually allocated. Qdirstat distinguishes between allocated size and apparent size and can list sparse files, so a 100 GB virtual disk that occupies only 12 GB will not mislead you.

Symbolic Links

Qdirstat does not follow symbolic links during a scan, which prevents loops and double counting. Broken symbolic links, which point to targets that no longer exist, can be listed through the Discover menu and are often leftovers from removed software.

Reserved Blocks and Free Space

Filesystems such as ext4 reserve a percentage of blocks for the root user, typically five percent. This explains why a partition can appear full to normal users while space technically remains. Qdirstat’s mounted filesystems overview shows used, free and reserved space side by side, making this behaviour easy to understand.

Deleted but Open Files

A file deleted while a program still holds it open keeps occupying space until that program closes it. Such files appear in no directory, so no disk analyser can show them in a tree. If Qdirstat’s totals are clearly lower than what df reports, run sudo lsof +L1 to find these invisible files, then restart the responsible service.

Configuring Qdirstat for Linux Systems

A few settings make Qdirstat more effective on Linux. Exclude rules let you skip directories you never want analysed, such as .git folders, Btrfs .snapshots or large media libraries you already manage elsewhere. The “Cross Filesystems” option controls whether scans continue into other mounted filesystems; leave it off for a clear view of a single partition. Custom cleanup actions can wrap commands you use often, such as clearing a cache directory or running git gc on a repository.

Frequently Asked Questions

Which Linux distributions support Qdirstat?

Qdirstat is packaged for Debian, Ubuntu, Fedora, openSUSE, Guix and many others, and it is available for Arch through the AUR. Any distribution with Qt can build it from source.

Does Qdirstat work on Wayland?

Yes, as a normal user. Running it as root on Wayland may require extra steps because root applications often cannot access the user’s display session.

Can Qdirstat scan external drives on Linux?

Yes. Open the drive’s mount point directly, or enable “Cross Filesystems” if you want a scan of a parent directory to include it.

Is Qdirstat better than du for Linux users?

They complement each other. du is ideal for scripting and quick checks, while Qdirstat gives a complete visual overview and interactive cleanup.

Conclusion

Qdirstat is one of the most capable disk analysers available on Linux. It installs easily on almost every distribution, respects filesystem boundaries, understands package databases and works across desktops. Combine a narrow-first scanning workflow with careful cleanup and the right Linux-specific tools, and Qdirstat will keep every Linux machine you manage lean and well understood.