Use Qdirstat to identify the files and folders taking up the most space before deciding what to remove. The tree shows paths and totals, while the treemap makes large items easy to spot. Start with files you recognise, confirm the selection, and use the trash when you need a chance to recover a file after deletion.
Before You Delete Anything: Three Rules
- Back up first. A current backup turns a mistake into a minor inconvenience. Before a large cleanup, make sure important documents, photos and projects are safely copied elsewhere.
- Prefer the trash. Qdirstat can move files to the desktop trash, which gives you a chance to recover them. Use permanent deletion only for data you are certain about.
- Scan as your normal user. Running Qdirstat without root privileges means cleanup actions cannot damage system files, even by accident.
How Qdirstat Cleanup Actions Work
Cleanup actions are commands that Qdirstat runs on the selected files or directories. You trigger them from the Clean Up menu, the right-click context menu or keyboard shortcuts. Each action has a title, a shell command, rules about whether it applies to files, directories or both, and options such as whether to ask for confirmation and whether to refresh the view afterwards.
Qdirstat ships with useful default actions, including:
- Move to Trash, the safest way to remove personal files.
- Delete (no way to undo), which removes files permanently and always deserves caution.
- Open File Manager Here and Open Terminal Window Here, for inspecting a location before acting.
- Compress, which packs a directory into an archive to save space.
- make clean and git clean, which remove build artefacts in software projects.
- Delete Junk Files, which targets common backup and temporary file patterns.
Because actions are configurable, you can disable those you never want, rename them, change their commands or add new ones.
Creating Your Own Cleanup Actions
Custom actions are where Qdirstat really saves time. Open the settings, go to the cleanup actions page and add a new entry. In the command field, Qdirstat replaces placeholders such as %p with the full path of the selected item and %n with its name.
Some practical examples:
| Purpose | Command idea | Applies to |
|---|---|---|
| Remove Python caches | find %p -name __pycache__ -type d -prune -exec rm -rf {} + | Directories |
| Remove Node dependencies | rm -rf %p/node_modules | Directories |
| Compact a Git repository | git -C %p gc --aggressive | Directories |
| Compress a log file | xz -9 %p | Files |
| Move to an archive drive | mv %p /mnt/archive/ | Files and directories |
For any action that deletes or moves data, enable the confirmation option. Test new actions on a harmless sample folder before relying on them, and keep commands simple enough that you can read them at a glance.
Using the Discover Menu to Find Targets Quickly
The Discover menu provides ready-made lists that point you straight to cleanup candidates:
- Largest files shows the biggest individual files in the scanned tree, regardless of folder.
- Newest files reveals what has appeared recently, useful when space vanished suddenly.
- Oldest files highlights data untouched for years, ideal for archiving decisions.
- Files with multiple hard links explains apparent double counting in backup folders.
- Broken symbolic links lists links pointing nowhere, often leftovers from removed software.
- Sparse files identifies files whose apparent size exceeds their real disk usage.
Each list opens in a window where you can select entries and run cleanup actions directly. The largest files list alone often accounts for most of the space you can reclaim.
Places That Are Usually Safe to Clean
Caches in Your Home Folder
~/.cache holds data that applications can regenerate: browser caches, thumbnails, package manager caches for pip, npm or Cargo, and more. Close the related applications, then move large cache folders to the trash. They will be rebuilt as needed.
Downloads
Installers, ISO images and archives that served their purpose often pile up in ~/Downloads. Sort by size and date, keep what you need and remove the rest.
Build Artefacts
Software projects accumulate node_modules, target, build and dist folders. These can be regenerated from source, so removing them from inactive projects is safe and frees a surprising amount of space.
Trash
Files moved to the trash still occupy disk space. Qdirstat shows ~/.local/share/Trash clearly; empty it once you are sure.
Places to Clean Only with the Proper Tools
- Package caches in
/var/cache/apt,/var/cache/dnfor/var/cache/pacman: useapt clean,dnf clean allorpaccache. - System logs in
/var/log/journal: usejournalctl --vacuum-sizeor--vacuum-time. - Container data in
/var/lib/dockeror/var/lib/containers: usedocker system pruneor the Podman equivalent. - Snap and Flatpak data: use their own commands to remove old revisions and unused runtimes.
- Installed applications: remove them through your package manager, guided by Qdirstat’s package view.
Places You Should Never Clean Manually
Some directories are essential to a working system. Deleting files from them, even ones that look unused, can prevent your computer from starting or break software in subtle ways.
/usr,/bin,/liband/sbin, which hold installed programs and libraries./etc, which contains system configuration./boot, which holds kernels and the boot loader configuration./var/libdatabases belonging to package managers and services./proc,/sysand/dev, which are virtual filesystems and not real files at all.
If one of these locations seems too large, investigate through the package view and remove software with your package manager instead.
Using File Age Statistics to Plan Archiving
Not every large file is waste. Photographs, finished projects and old documents may be valuable yet rarely accessed. Qdirstat’s file age statistics window shows how much data was last modified in each year and month. If several hundred gigabytes have not changed in five years, moving them to an external drive or an archive server can free your main disk without losing anything.
A practical approach is to select an old directory, check its age profile, then use a custom “Move to Archive” cleanup action that moves it to a mounted archive drive. Because the files are moved rather than deleted, the process is fully reversible.
Cleaning Up After Software You Removed
Uninstalling an application through a package manager usually leaves personal configuration and data behind in your home folder, inside ~/.config, ~/.local/share and ~/.cache. Over the years these leftovers accumulate. Qdirstat makes them visible: sort these folders by size and look for names belonging to applications you no longer use. Moving such folders to the trash is generally safe, but check that the application is truly gone first, because some names are shared by related programs.
At system level, the unpackaged files view helps you find files under /usr/local or /opt that no package owns. These are often remnants of software installed manually. Remove them using the original uninstall method where possible, such as sudo make uninstall from the source directory.
Common Cleanup Mistakes to Avoid
- Deleting while applications are running. Removing caches or data of an open program can corrupt its state. Close it first.
- Trusting names alone. A folder called
tmporoldmay still contain something important. Inspect before removing. - Forgetting the trash. Moving files to the trash does not free space until you empty it.
- Cleaning as root by habit. Elevated privileges remove the safety net that protects system files.
- Ignoring the root cause. If a log grows by gigabytes daily, deleting it only postpones the problem.
A Repeatable Qdirstat Cleanup Workflow
- Scan the directory you want to clean as a normal user.
- Check the largest and oldest files through the Discover menu.
- Explore the biggest clusters in the treemap and confirm paths in the tree.
- Move personal clutter to the trash; use dedicated tools for system data.
- Refresh the affected branch to confirm the space has been recovered.
- Empty the trash only after a short waiting period, once nothing is missed.
Frequently Asked Questions
Can Qdirstat undo a deletion?
No. Qdirstat cannot restore permanently deleted files. Use the Move to Trash action whenever possible so you can recover mistakes.
Is it safe to delete ~/.cache with Qdirstat?
Generally yes, while the related applications are closed. Applications rebuild their caches, though the first launch afterwards may be slower.
How do I add a custom cleanup action in Qdirstat?
Open the settings, choose the cleanup actions page, add a new action and enter a shell command using placeholders such as %p for the selected path.
Why should I not delete package caches directly?
Package managers track their caches and may need certain files. Their own clean commands remove data safely and consistently.
Conclusion
Qdirstat turns disk cleanup from guesswork into a clear, repeatable process. Back up first, prefer the trash, scan as a normal user and let the Discover menu and treemap point you to the biggest opportunities. Create custom cleanup actions for tasks you repeat, leave system data to package managers and dedicated tools, and never touch core system directories by hand. Follow these principles and Qdirstat will help you reclaim space confidently, every time.



