-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean-eos.sh
More file actions
69 lines (56 loc) · 1.49 KB
/
clean-eos.sh
File metadata and controls
69 lines (56 loc) · 1.49 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
58
59
60
61
62
63
64
65
66
67
68
# Remove orphaned packages
paru -Sccd
# Remove more orphaned packages
sudo pacman -Qtdq | sudo pacman -Rns -
# Remove uninstalled packages from cache
sudo paccache -ruk0
# Clean go cache
if type go &> /dev/null; then
echo "Cleaning go caches"
go clean -cache
go clean -fuzzcache
go clean -modcache
fi
# Clean rust cache
# https://github.com/rust-lang/cargo/issues/3289#issuecomment-1086844583
if [ -e ~/.cargo/registry ]; then
echo "Cleaning Rust cache"
rm -r ~/.cargo/registry/{cache,src} &> /dev/null
fi
# Clean npm cache
if type npm &> /dev/null; then
echo "Cleaning npm cache"
npm cache clean --force
fi
# Clean spotify cache
if [[ -e ~/.cache/spotify/Data/ && -n "$(ls -A ~/.cache/spotify/Data/)" ]]; then
echo "Cleaning Spotify cache"
rm -r ~/.cache/spotify/Data/*
fi
# Clean yarn cache
if [ -e ~/.cache/yarn ]; then
echo "Cleaning Yarn cache"
yarn cache clean
fi
# Clear pnpm store
if [ -e ~/.local/share/pnpm ]; then
echo "Cleaning pnpm store"
pnpm store prune
fi
# Clear coredumps
if [[ -e /var/lib/systemd/coredump/ && -n "$(ls -A /var/lib/systemd/coredump/)" ]]; then
echo "Cleaning coredumps"
sudo rm /var/lib/systemd/coredump/*
fi
# Clear journalctl
echo "Cleaning all journalctl entries"
sudo journalctl --rotate
sudo journalctl --vacuum-time=1s
# Clear docker
if type docker &> /dev/null; then
echo "Cleaning dangling docker images and volumes (without used images)"
docker system prune --force --volumes
fi
# Empty trash
echo "Cleaning trash"
gio trash --empty