-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleanup.sh
21 lines (20 loc) · 991 Bytes
/
cleanup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/bash
sudo apt-get update #Updates the package lists for upgrades and new installations
sudo apt-get upgrade -y #upgrade all softwares to latest version
sudo apt-get autoremove && sudo apt-get autoclean #autoremove removes packages that were automatically installed but are no longer required and autoclean removes unnecessary packages and files from the package cache
sudo apt-get clean #Deletes all packages from the package cache.
sudo journalctl --rotate #Rotates and archives the journal files
sudo journalctl --vacuum-time 1d #Clears all log files older than 1 day.
rm -rf ~/.cache/thumbnails/* #Removes thumbnail cache files
# 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
sudo snap remove "$snapname" --revision="$revision"
done
if command -v notify-send &> /dev/null; then
notify-send "Cleaning done"
else
echo "Cleaning done"
fi