Last active
May 30, 2022 08:46
-
-
Save benzerbett/c03f3fbaf1a5942d340cd01e21d44175 to your computer and use it in GitHub Desktop.
System cleanup script for Ubuntu, Elementary etc
This file contains 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 | |
# Removes old revisions of snaps | |
# CLOSE ALL SNAPS BEFORE RUNNING THIS | |
set -eu | |
flatpak uninstall --unused | |
journalctl --rotate | |
journalctl --vacuum-time=1s | |
apt autoclean -y | |
apt autoremove --purge -y | |
apt-get clean -y | |
sudo find /tmp -type f -atime +10 -delete | |
rm -rf ~/.cache/thumbnails/* | |
LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' | | |
while read snapname revision; do | |
snap remove "$snapname" --revision="$revision" | |
done | |
npm cache clean --force | |
yarn cache clean | |
pip cache purge | |
pip3 cache purge | |
go clean -modcache | |
docker image prune -f | |
docker image prune -a -f | |
docker rmi $(docker images -f "dangling=true" -q) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker rmi $(docker images -f "dangling=true" -q) so helpfull