The below instructions show how to swiftly navigate around in your folders and move select files to your personal Trash folder. When you are ready, and certain you didn’t make any mistakes, you can choose to empty your Trash folder. It is only when you empty your Trash folder that your disk quota decreases.
[alice@dev2 ~]$ module load CBI ncdu trash-cli
Go to the root of the folder you would like to scan for files to be cleaned up. If you are interested in scanning all of your HOME folder, do:
[alice@dev2 somewhere]$ cd ~
[alice@dev2 ~]$
If you like to clean up a specific folder, go there, e.g.
[alice@dev2 ~]$ cd projects/superduper
[alice@dev2 superduper]$
Next, we will pre-scan the folder recursively to find the size of all files and folders therein;
[alice@dev2 ~]$ ncdu --one-file-system -o ncdu.cache
This will make it faster to navigate subfolders when selecting what to
delete in the next step. Strictly speaking, this is not necessary for
using ncdu to clean up files, but we highly recommend it, especially
for large folder. Depending on how many files are scanned this might
take anything from seconds to minutes to complete. When it’s done,
there will be a file ncdu.cache in the current directory.
Now we are ready to start cleaning up among the pre-scanned files. To do this, launch:
[alice@dev2 ~]$ ncdu --enable-delete -f ncdu.cache --delete-command "trash --"
This will open up a text-based user interface (TUI) displaying the size of files and folders. This TUI makes it easy to navigate in and out of folders and delete files. Press ? to see available keyboard shortcuts. The most useful ones are:
When you delete, you will be asked to confirm with “yes”, “no”, or
“don’t ask me again”, after which the files are swiftly moved to
your personal Trash folder. Keep deleting files this way until you are
done. Press q to exit ncdu when you are ready.
When you’re done, remove the temporary ncdu.cache file;
[alice@dev2 ~]$ rm ncdu.cache
You can use trash-list to see what is in your personal Trash folder,
e.g.
[alice@dev2 ~]$ trash-list
2025-12-21 12:31:23 /home/alice/.cache/R/pkgdown
2025-12-21 12:31:24 /home/alice/.cache/R/litedown
2025-12-21 12:30:20 /home/alice/.cache/R/R.cache
2025-12-21 12:31:21 /home/alice/.cache/R/sass
[alice@dev2 ~]$
You can restore files using trash-restore. See trash --help for
more details.
To empty your personal Trash folder, run:
[alice@dev2 ~]$ trash-empty
Would empty the following trash directories:
- /home/alice/.local/share/Trash
Proceed? (y/N)
If you deleted a lot of files and folders, this may take several minutes to complete.
The default location of your personal Trash folder is
~/.local/share/Trash/. The above instructions move deleted files
to this Trash folder, because we used ncdu ... --delete-command
"trash --". Moving files and folders is very fast, regardless of file
system. The command trash-empty is slow, much like rm is slow,
because it removes the files.