Sources:

Find largest directories

Start in your home directory, find the largest, then go deeper into the large ones.

This shows just the top 10.

du -sh * | sort -hr | head -n 10

Temporary files

Clear tmp directory

$ rm -rf /tmp/*

Delete cache

Note this will also delete Poetry-created virtual environments.

On macOS:

$ rm -rf ~/Library/Caches/*

On macOS and Linux:

$ rm -rf ~/.cache/*

Delete logs

Just the zip files.

On macOS:

rm -f /private/var/log/*.{bz2,gz}

Remove thumbnails

Linux:

$ du -sh ~/.cache/thumbnails
818M    /home/michael/.cache/thumbnails
$ rm -rf ~/.cache/thumbnails/*

APT

For Debian/Ubuntu.

Remove cache

Essential Guide: 5 Simple Ways To Free Up Space on Ubuntu

$ sudo apt-get clean

Check size of archives. This dropped to 184K after running clean above.

$ sudo du -sh /var/cache/apt/archives
1.8G    /var/cache/apt/archives

Remove unused packages

$ sudo apt-get autoremove

Remove packages by name

$ sudo apt-get remove package-name1 package-name2