In advance I am sorry if similar question has been answered, but none of those solutions work for me. I am fairly new in using Ubuntu (6-7 months now) and recently whenever I start my laptop a warning pops up that my /var is low on space (it has about 100MB left). I have been going through forums and I tried to delete my snaps and some journal files but it doesn't free up a lot of space with autoremove and similar commands. I would be very thankful if someone could give me at least explanation if there is no better solution than those mention above for my problem. These are screenshots how much space I parted for /var and my screenshot of disk usage in /var. Once again, thanks for your time, much appreciated!
Asked
Active
Viewed 1.1k times
1 Answers
5
This is how you can clean /var in Ubuntu for storage issue:
Get rid of packages that are no longer required
sudo apt-get autoremoveUninstall unnecessary applications from your store.
Clean up APT cache in Ubuntu
sudo du -sh /var/cache/apt # see the size of cache you have sudo apt-get clean # to clean the cacheClear
systemdjournal logsjournalctl --disk-usage # check the storage used in old logs sudo journalctl --vacuum-time=3d # to clear logs before 3 days - number before d can be changedRemove older versions of Snap applications. Create a file by any name and
.shextension and paste the following script#!/bin/bash # Removes old revisions of snaps # CLOSE ALL SNAPS BEFORE RUNNING THIS set -eu LANG=C snap list --all | awk '/disabled/{print $1, $3}' | while read snapname revision; do snap remove "$snapname" --revision="$revision" doneand then make it executable using this command in terminal
chmod +x <fileName>Run the script using
./<fileName>.Clean the thumbnail cache
du -sh ~/.cache/thumbnails # check the thumbnails size rm -rf ~/.cache/thumbnails/* # clean the thumbnails
Kulfy
- 18,154

