How to Detect and Clean Up Hard Disk Storage with QDirStat in Linux

QDirStat is an evolution of the tried and tested KDirStat tool by the same author, Stefan Hundhammer. Both programs serve the same purpose: to provide statistical information about computer storage usage in a human-friendly manner.

The program does not display its findings in raw numbers and percentages, but in a hierarchical tree structure and graphical map. This makes it easy to find the maximum space consumption: find and delete unwanted files and reclaim the space they occupy.

Out of self-awareness, QDirStat knows that we will use it to reclaim storage space and includes some features that help with this purpose. The application not only displays statistics about the file, but also lets you manipulate it. You can delete them through the app, remove remnants or run from GIT sync, and delete junk files. You can customize all of this or add your own cleanup scheme.

Install QDirStat

You may find QDirStat in the software center of your distribution. Search and install using its name from the release’s main graphics software management tool.

If you prefer the terminal, you can take it with you in Debian and Ubuntu compatible distributions:

sudo apt install qdirstat

Unlike the older sibling version, KDirStat, QDirStat does not require KDE (or Gnome or other desktop environment) libraries except QT and Perl, so it is relatively quick and easy to install.

Choose the path to analyze

After running, QDirStat jumps directly into the operation by asking the source path that should be investigated. You can choose any local or remote path that is accessible through the file manager (for example, an SMB share on a local Windows network). If it is installed and accessible, QDirStat can use it.

Qdirstat recycle storage path to analyze

After selecting the path, click “Open” to select it, and then move to the main window of QDirStat.

Tree and visual diagrams

After a brief analysis of the content of the selected path, QDirStat will display the results of its discovery in two different ways in its main window.

The first is the “tree view”, which is the same tree view that a typical file manager might be familiar with. The difference is that by default, QDirStat arranges each entry according to its size, with the largest space pig on top.

At first glance, you can see the percentage occupied by the folder, its actual size (in (K / M / T) bytes), etc.

Just like the tree view of the file manager, you can expand any folder to see its contents by clicking the small arrow on the left.

Qdirstat recycle store different views

At the bottom of the window, you can see a second graphical view of everything in the path.

Each rectangle represents a different file. The larger the rectangle, the larger the storage space occupied by the file.

Delete and delete files

Once you find the file or folder you want to erase, right-click it and select “Move to rash” or select it and press the Delete key on your keyboard.

Files / folders will remain in the Recycle Bin folder of the operating system until they are cleared or space is needed by other files.

Qdirstat recycle storage garbage delete

To delete permanently, select the “Delete (Can’t delete!)” Option, or press Ctrl + Delete on your keyboard and select a file or folder.

As explicitly stated, it is not useful to double-check what was deleted using this option, because the operation is not undone.

Compression and cleanup actions

When selecting folders instead of files, QDirStat provides more options to reclaim lost storage space.

Right-click on a folder and QDirStat will allow you to compress its contents (create bz2 files using tar) to reduce the space they occupy.

Qdirstat recycle storage compressed folder

You can also clear any remnants of make or GIT sync by selecting those options (“make clean” and “git clean”) from the right-click menu.

Avoid using “Clear Directory Content” as it will erase everything in the folder (unless you need to do this).

Finally, Delete Junk Files deletes the files it finds in the selected path identified as junk files. You can specify your identity in the Settings of QDirStat.

Clean up customization

To choose “Settings> Configure QDirStat” precisely, configure QDirStat. The program divides its customization options into four tabs.

Qdirstat recycle storage customization

Cleanup action Allows you to check existing features that the program can run on selected files and folders. Although their names indicate that they are only related to data deletion, here you will also find the “Open File Manager Here” and “Open Terminal Here” options. You can reorganize actions and add new ones as needed.

MIME category Here you can define different groups of files based on the pattern identified in the file name. For example, you can include temporary files in the Spam MIME category by adding a “* .tmp” entry in the “Mode (case-insensitive)” field.

Exclusion rule Make up a list of files and folders that the program will not touch. It is best to add all important folders and files here that you do not want to be affected by the operation of the program.

general Contains some basic options about the operation and aesthetics of the application-skip it at any time.

keep clean

QDirStat is very useful when finding large but useless files that take up storage space, but as we have seen, it can be even more useful if you customize existing or set up your own cleanup operations.

In this way, you will know their respective roles and their impact on the file, and create a cleanup scheme, with just two clicks to send extra data to the forgotten place.