Disk usage: Find out where your space goes

When you are using your system a lot, files accumulate and eventually your hard disk will be full. I have encountered this very issue just now, and thought I share a nice utility I discovered.

First of all, the ugly:

$ df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/cryptroot  938G  872G   19G  98% /

I’m at 98% of capacity. 19GB space was a lot 10 years ago, but today … A quick search with guix package -s disk revealed a bunch of options, of which one caught my attention:

name: duc
version: 1.4.4
outputs: out
systems: x86_64-linux i686-linux
dependencies: autoconf@2.69 automake@1.16.2 cairo@1.16.0 libtool@2.4.6 ncurses@6.2 pango@1.44.7 pkg-config@0.29.2 tokyocabinet@1.4.48
location: gnu/packages/disk.scm:1311:2
homepage: http://duc.zevv.nl
license: LGPL 3+
synopsis: Library and suite of tools for inspecting disk usage  
description: Duc maintains a database of accumulated sizes of directories of the file system, and allows you to query this database with some tools, or create fancy graphs showing you where your bytes are.
+ 
+ Duc comes with console utilities, ncurses and X11 user interfaces and a CGI wrapper for disk usage querying and visualisation.
relevance: 10

(1) Installation

Let’s give it a try

guix package -i duc

(2) Indexing

Next step, duc needs to analyze your disk to build an index. You will need to re-run this step, whenever there are significant changes on your hard disk.

duc index /home/franz

(3) Result

Let’s see what kind of information we can get now.

GUI

Here’s how you get a a nice GUI where you can zoom in and out, click on an area to get more detail, and “discover” where your space goes.

duc gui

Terminal

If you need something a little … more in your face:

$ duc ls
109.3G .bitmonero
 82.1G Movies
 79.5G Pictures
 69.2G Music
 55.4G Videos
 50.4G Torrents
 42.1G VM
 36.0G git
 19.1G Backup
 17.0G Sync
 14.8G .local
 14.0G Desktop
  6.1G .cache
  5.3G Android
  4.0G Downloads
  3.8G .npm
  2.7G Documents
  2.3G .gradle
  2.2G .claws-mail
  1.8G .var
  1.5G Dropbox
830.5M .mozilla
830.4M .config
618.1M .recoll
438.8M .vscode-oss
...

Time to do some organizing!