-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_dnf-cleanup-script.sh
More file actions
57 lines (40 loc) · 1.16 KB
/
dot_dnf-cleanup-script.sh
File metadata and controls
57 lines (40 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
sep=" ==== "
fancify() {
return $sep$1$sep
}
done=$(fancify("done!"))
echo $(fancify("starting cleanup"))
echo $(fancify("updating packages..."))
sudo dnf upgrade --refresh -y
echo $done
echo $(fancify("removing unused/orphaned packages..."))
sudo dnf autoremove -y
echo $done
echo $(fancify("cleaning up cache..."))
sudo dnf clean all
echo $done
echo $(fancify("Cleaning cache after a system upgrade"))
sudo dnf system-upgrade clean
echo $done
echo $(fancify("Cleaning /tmp and KDE cache..."))
sudo rm -rf /tmp/*
rm -rf ~/.cache/*
echo $done
echo $(fancify("Removing old versions of Flatpak apps..."))
flatpak uninstall --unused
echo $done
echo $(fancify("Running Flatpak repair to clean up caches and orphaned files..."))
flatpak repair
echo $done
# OPTIONAL - Uncomment lines below if flatpack cache needs to be cleared
echo $(fancify("Clearing Flatpak download cache..."))
sudo rm -rf /var/tmp/flatpak-cache-*
echo $done
echo $(fancify("Cleaning up journal logs, keeping the last week..."))
sudo journalctl --vacuum-time=1m
echo $done
echo $(fancify("Removing broken symlinks..."))
find ~ -xtype l -delete
echo $done
echo $(fancify("Cleanup Completed!"))