Time to Free up Space on Ubuntu.
Margaret W.N
Posted on September 24, 2020
Out of Space? Welcome to the club. Time for some space hunt. Here are some techniques that came through for me, today. You might want to start with the last one, it will save you so much work.
- Remove all unused packages.
sudo apt-get autoremove
- Clear the APT cache.
Check the cache size:
sudo du -sh /var/cache/apt
Clear cache
sudo apt-get clean
- Clear systemd journal logs. This freed up a good amount of space.
Check the space occupied:
journalctl --disk-usage
Clean out some logs. You might want to read about this: Clearing systemd journal logs in linux. But if you are in dire need of space and have no time, use the command below. It will clear all the logs older than 2 days.
sudo journalctl --vacuum-time=2d
- Remove older versions of Snap applications Check the space occupied
du -h /var/lib/snapd/snaps
Create a script file, add the lines below, and save. I saved mine as script.sh on Home directory.
set -eu
snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done
Give the file execute permissions
chmod 0700 script.sh
Run the script to remove older packages.
sudo ./script.sh
- Uninstall apps you don't use. Stop saving them for the future! Easy for me to say but this was hard for me. I resorted to deleting everything I haven't used in the past two months, or anything with an online alternative.
All the above freed up about 3 to 4 GB, then came the mother of all space eaters, my trash! Quite embarrassing and funny cause I did not think of the trash at all until I installed Stacer and the analytics were screaming at me: Take out the trash!
- Install Stacer and let the system cleaner do the work for you. You can search ubuntu software or use the command below to install.
sudo apt install stacer
That's it for day 70: 100 days of code
Lets do this again tommorrow
Posted on September 24, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 11, 2021