QDirStat is a graphical application to show where your disk space has gone and to help you to clean it up.
This is a Qt-only port of the old Qt3/KDE3-based KDirStat, now based on the latest Qt 5. It does not need any KDE libs or infrastructure. It runs on every X11-based desktop on Linux, BSD and other Unix-like systems and of course in a Docker container.
Please check our application chart to see which GigaDrive Plans are eligible to install this application.
QDirStat has a number of new features compared to KDirStat. To name a few:
- Multi-selection:
- Both views (the tree and the treemap) now support extended selection, i.e. you can select more than one item. This was the most requested feature for the last KDirStat. Now you can select more than one item at the same time to move it to the trash can, to directly delete it or whatever.
- Tree view:
- Shift-click: Select a range of items.
- Ctrl-Click: Select an additional item or deselect a selected one.
- Treemap:
- Ctrl-Click: Select an additional item or deselect a selected one.
- The current item is highlighted with a red rectangle, all other selected ones with a yellow rectangle. If the current item is not also selected, it has a dotted red outline.
- Proper output of cleanup actions with different colors for the commands that are executed, for their output and for error messages (see screenshot above). That output window can be configured to always open, to open after a certain (configurable) timeout, or only if there are error messages – or not at all, of course. If things go wrong, you can kill the external command started by the cleanup action from there. You can zoom in and out (increase or decrease the font size) as you like.
- File type statistics window. WinDirStat has it, and users wanted it in QDirStat, too. Since filename extensions (suffixes) don’t have as much semantics in Linux/Unix systems as they do in Windows, many files are categorized as “Other”. This is a known limitation, but it’s a limitation of the whole concept of using suffixes to categorize files by type. And no, checking file headers for magic byte sequences like the “file” command does is not an option here; QDirStat would have to do that for (at least) all the 30,000+ files typically listed under the “Other” category. So we’ll have to live with that limitation.
- Locate files by file type window. If you double-click on any of the filename extensions (suffixes) in the file type statistics window, you will get another window that lists all the directories that contain files of that type including the number and total size of those files. You can double-click each of those lines, and that directory will open in the main window with the files of that type preselected so you can start cleanup actions like moving them to trash or converting them to a better format (.bmp -> .png) immediately.
- File size statistics window with histogram, percentiles, buckets and a lot of documentation that everybody should be able to understand. Even if (or, better yet, in particular if) your math teacher or statistics professor never explained it properly, please have a look at it.
- File age statistics window: This lists the number and total size of changed files by years and for recent (13-24) months. You can see in what time frame there was any activity (i.e. any changes) in a directory tree, i.e. when it last was in active use; or if it might be a good candidate to be moved to archive media.
- Packages view: Show installed packages and their files in the tree. Supported for all Linux distributions using any of dpkg, rpm, pacman as their low-level package manager or any higher-level package manager like apt, zypper etc.; more details at
Pkg-View.md
.
- Unpackaged files view: Show a directory tree, but ignore all files that belong to an installed software package. Those ignored files are displayed in a special branch in the tree view, and they are not displayed at all in the treemap. This is useful to find files that were manually installed by a sudo make install command. More details at
Unpkg-View.md
.
- New macros to use in cleanup actions:
- %d : Directory name with full path. For directories, this is the same as %p. For files, this is their parent directory’s %p.
- %terminal : Terminal window application of the current desktop; one of “konsole”, “gnome-terminal”, “xfce4-terminal”, “lxterminal”, “eterm”. The fallback is “xterm”.
- %filemanager : File manager application of the current desktop; one of “konqueror”, “nautilus”, “thunar”, “pcmanfm”. The fallback is “xdg-open”.
- Which desktop is used is determined by the $XDG_CURRENT_DESKTOP environment variable. Users can override this with the $QDIRSTAT_DESKTOP environment variable, so you can get, say, the Xfce terminal or file manager despite currently running KDE if you set
- export QDIRSTAT_DESKTOP=“Xfce”
- Of course, you can still simply use your favourite file manager if you simply change %filemanager in the default “Open File Manager Here” cleanup action to the command to start it.
- You can now select the shell to use for the cleanup commands:
- $SHELL (the user’s login shell) - using the same environment, syntax and wildcard etc. behaviour of the shell the user is used to.
- /bin/bash for well-defined behaviour for wildcards etc.
- /bin/sh as a last resort (which might be a simplistic dash on Ubuntu).
- Mouse actions in the treemap window:
- Left click: Select item and make it the current item.
- Right click: Open the context menu with cleanup actions and more.
- Ctrl+Left click: Add item to selection or toggle selection.
- Middle click: Like left click, but also show directory borders.
- Ctrl+Middle click: Like Ctrl+left click, but also show directory borders.
- Double click left: Zoom treemap in.
- Double click middle: Zoom treemap out.
- Mouse wheel: Zoom treemap in or out.
- You can configure what columns to display in the tree view and in which order. The only thing that is fixed is the “Name” column which is always there and always the first (leftmost). Use the context menu in the tree header to unlock column widths. Drag columns to the left or right to change their order.
- Exclude rules are now greatly simplified. They no longer always get the entire path to match which requires quite complex regexps; by default, they only get the last path component – i.e., no longer “/work/home/sh/src/qdirstat/src/.git”, but only “.git”. You can now even tell the exclude rule to use a simplified syntax: “FixedString” or “Wildcard” in addition to the normal “RegExp”. The old behaviour (matching against the full path) is still available, though.
- Configuration dialog for exclude rules – see screenshots.
- Subvolume detection for Btrfs. Btrfs subvolumes are just ordinary mount points, so normally QDirStat would stop scanning there, leaving a large part of a Btrfs partition unaccounted for. But for each mount point found while scanning a directory tree, QDirStat checks /proc/mounts or /etc/mtab if it has the same device name as its parent directory, and if yes, considers it a subvolume and continues scanning.
- Actions to go one directory level higher or to the toplevel: Context menu and menu “Go To” -> “Up One Level” or “Toplevel”. This is useful if you clicked on a file in the treemap that is deep down in some subdirectory, and you want to know what subdirectory that is: Simply click “Go Up” twice (the first click will get you to the pseudo subdirectory, the second one to the real one).
- Open all tree branches up to a certain level and close all other ones: Menu “View” -> “Expand Tree To Level” -> “Level 0” … “Level 9”.
- The total sum of the selected items (subtrees) is displayed in the status line if more than one item is selected.
- Icons are now compiled into the source thanks to Qt’s resource system; now it’s just one binary file, and nothing will go missing. No more dozens of little files to handle.
- The build system is now Qt’s QMake. I got rid of that AutoTools (Automake, Autoconf, Libtool) stuff that most developers find intimidating with its crude M4 macro processor syntax. QMake .pro files are so much simpler, and they do the job just as well. And no, it will definitely never be CMake: I don’t like that thing at all. It’s just as much as a PITA as the AutoTools, just not as portable, no usable documentation, it’s changing all the time, and those out-of-source builds are a royal PITA all on their own with constantly having to change back and forth between source and build directories.
- QDirStat now has its own log file. It now logs to /tmp/qdirstat-$USER/qdirstat.log (where $USER is your Linux user name). No more messages on stdout that either clobber the shell you started the program from or that simply go missing.
- No longer depending on dozens of KDE libs and a lot of KDE infrastructure; it now only requires Qt which is typically installed anyway on a Linux / BSD / Unix machine with any X11 (graphical) desktop.
- It should still compile and work with Qt4. We now have a contributor who is very interested in that (Michael Matz), so it should be possible to maintain this compatibility.
- Slow down display update from 333 millisec (default) to 3 sec (default) with qdirstat --slow-update or qdirstat -s. The slow update interval can be customized in ~/.config/QDirStat/QDirStat.conf:
- Fast and efficient directory reading.
- Not crossing filesystem boundaries by default so you can see what eats up all the disk space on your root filesystem without getting distorted numbers due to all the other filesystems that are mounted there. If you absolutely wish, you can use “Continue reading at mount point” from the context menu or from the “File” menu – or configure QDirStat to always read across file systems.
- Efficient memory usage. A modern Linux root filesystem has well over 800,000 objects (files, directories, symlinks, …) and about 100,000 directories. This calls for minimalistic C++ objects to represent each one of them. QDirStat / KDirStat do their best to minimize that memory footprint.
- Hierarchical tree view that displays accumulated sums in each branch, together with a percent bar so you can see at a glimpse how the subdirectories compare with each other.
- All numbers displayed human readable – e.g., 34.4 MB instead of 36116381 Bytes.
- All size units are 1024-based, i.e. 1 kB = 1024 Bytes; 1 MB = 1024 kB; 1 GB = 1024 MB.
- In the tree, also displaying the exact byte size as the context menu (right click).
- Each tree level uses another color for that percent bar so you can easily compare subdirectories even if some of them are opened in the tree.
- If a directory has files and subdirectories, all files in that subdirectory are grouped into a pseudo directory (called dot entry in the QDirStat sources) so you can compare the disk usage of files on that directory level with the subdirectories.
- Displaying the latest modification time of any object in each branch. You can instantly see in what subdirectory where any changes lately. You can sort by this column, of course.
- Treemap display. Treemaps are a way to visualize hierarchical data structures, invented by Ben Shneiderman. Basically, the hierarchy is flattened and each level grouped in a rectangle, inside which it is again subdivided in rectangles. The area of each rectangle corresponds to the size of each item or subdirectory. For the purposes of QDirStat, it is enough to know that a large blob corresponds to a large file; you can instantly see where large ISOs or movies are.
- You can zoom the treemap in and out (Ctrl + / Ctrl - / mouse wheel / menu / tool bar) to see more details of directories that are otherwise dominated by larger ones.
- You can move the boundary between treemap and tree view up and down as you like. You can also get rid of the treemap completely (menu “Treemap” -> “Show Treemap” or F9 key)
- Treemap and tree list view communicate. Select an item in one view, and it is also selected in the other. If you click on that large blob in the treemap, it is located in the tree view, all branches up to its directory are opened, and the tree view scrolls to that item.
- Cleanup actions. Once you know what is consuming the disk space, you can start cleanup actions from within QDirStat to reclaim disk space - or to investigate further if you can safely delete a file. You can create your own cleanup actions (as many as you like), and there are some predefined ones:
- Open file manager here. This will start a file manager in the directory of the current item. QDirStat tries its best to guess the name of the relevant file manager application for the current desktop, based on the $XDG_CURRENT_DESKTOP environment variable. You can override this with the $QDIRSTAT_DESKTOP environment variable.
- Open terminal window here. In most cases, this is much easier than to navigate to that directory with ‘cd’ in an already open terminal window and using tab-completion numerous times. As with the file manager application, QDirStat tries its best to guess the name of the relevant terminal window application for the current desktop.
- Move to trash bin. QDirStat has its own implementation of the XDG trash specification.
- Delete immediately.
- Compress: Create a compressed tar archive from a directory and then delete the directory.
- Delete junk files: Backup files left behind by editors, core dumps.
- All predefined cleanup actions are fully configurable, of course. You can change any of them, disable them, or delete them.
- You can copy the complete path of the selected file or directory to the system clipboard and paste it to another application.
- Reading and writing cache files:
- This is mostly meant for remote servers in some server room somewhere: Rather than installing the Qt and X11 runtime environment and running QDirStat over remote X (ssh with X forwarding), you can run the supplied qdirstat-cache-writer Perl script on the server, copy the resulting cache file to your desktop machine and view the content there with QDirStat.
- For large directories (archives etc.) that don’t change that much, you can also generate a QDirStat cache file (either with the Perl script or with QDirStat itself) and save it to that corresponding directory. If QDirStat finds a file .qdirstat.cache.gz in a directory, it checks if the toplevel directory in that cache file is the same as the current directory, and if it is, it uses the cache file for that directory rather than reading all subdirectories from disk. If you or the users of that machine use QDirStat often, this might take a lot of I/O load from the server.
- If you use the ‘-l’ option of the qdirstat-cache-writer script, it uses the long file format with a complete path for each entry, so you can use the zgrep command with it as a replacement for the locate command.
- The KDirStat / QDirStat file format is well documented and very simple. It seems to be used by a number of admins and some backup software. See also the specification in the doc/ directory:
- You can specify a cache file to read directly at the command line:
- Navigate to the Application Manager page and search for
qdirstat
.
- Click icon to open the installation window and tap Install to start the installation process.
- Once the installation is complete, click icon to open the Access Info page. Then click Go To Application to access
qdirstat
.