Freeing up disk space - Linux

Reference: article

  • sudo apt-get autoremove
  • Remove apt cache: sudo apt-get clean
  • sudo journalctl --vacuum-time=3d
  • Remove old revisions of snaps:
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
snap list --all | awk '/disabled/{print $1, $3}' |
    while read snapname revision; do
        snap remove "$snapname" --revision="$revision"
    done
  • Clean the thumbnail cache:

rm -rf ~/.cache/thumbnails/*

Can use ncdu to check disk space from command line as well.