Last active
March 14, 2021 21:11
-
-
Save numpde/ee00c841f67e26d050ec813d082ed309 to your computer and use it in GitHub Desktop.
Clean Ubuntu: logs, trash, snaps, etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# From | |
# https://itsfoss.com/free-up-space-ubuntu-linux/ | |
# APT | |
sudo apt-get autoremove | |
sudo apt-get clean | |
# Clear systemd journal logs | |
sudo journalctl --vacuum-time=3d | |
# 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 | |
# | |
rm -rf ~/.cache/thumbnails/* | |
# From | |
# https://itsfoss.com/fix-empty-trash-ubuntu | |
rm -rf ~/.local/share/Trash/* | |
# https://docs.conda.io/projects/conda/en/latest/commands/clean.html | |
conda clean -ay |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment