-
Notifications
You must be signed in to change notification settings - Fork 1
/
clean-cache
executable file
·91 lines (78 loc) · 2.22 KB
/
clean-cache
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
# exec 2>/dev/null
function rm-star {
local dir=$1
if ! hash realpath; then
return
fi
while [[ "$dir" =~ // ]]; do
dir=${dir/\/\//\/};
done
if [[ / == "$(realpath "$dir")" ]]; then
echo will not nuke slash.
return
fi
echo nuke [$dir/...]
[[ -d "$dir" ]] && echo rm -fr "$dir/"'*'
}
x-del-p() { xargs -r -0 -I% find "%" -type f -print; }
x-del-p() { xargs -r -0 -I% find "%" -type f -print -delete ; }
#rm -frv dot/cpanm/*
#rm -fr -v cache/.ccache/?
#rm -fr -v cache/.cache/JetBrains/*/index/*
rm-star /var/tmp/portage
rm-star /root/.gem
rm-star /root/.npm
rm-star .cache/composer
rm-star .cache/npm/
rm-star .cache/pip
rm-star .cache/go-build
{
find \
.gem/gem \
.cpan/cpan \
.opam/opam \
.cargo/cargo \
.docker/docker \
.mozilla/mozilla \
.ansible/ansible -type l -delete
} &>/dev/null
{
find -maxdepth 5 '(' \
-path '*Slack' -or \
-path '*discord' -or \
-path '*chromium' -or \
-path '*skypeforlinux' -or \
-path '*chromium-jazzo' -or \
-path '*spotify/Browser' -or \
-path '*google-chrome' -or \
-path '*opera' ')' -print0 \
| xargs -0 -I% find "%" '(' \
-name 'Service Worker' -or \
-name 'Local Storage' -or \
-name 'IndexedDB' -or \
-name 'Cache' -or \
-name 'Code Cache' ')' \
-print0 | x-del-p
} 2>/dev/null
find .cache/spotify/Data -type f -delete
#find .cache/spotify -name Cache | xargs -r -I% find % -type f -print -delete
{
make clean -C /usr/src/linux
find -L /usr/src/linux | grep -Ee '(\.ko|\.o\.d|\.o|\.cmd)$' | xargs -r rm
rm -f /usr/src/linux/.tmp_*
rm -f /usr/src/linux/vmlinux
} 2>/dev/null
{
rm -fr .cache/mozilla/firefox/*/Cache/*
rm -fr .cache/mozilla/firefox/*/cache2/*
find .cache/mozilla/firefox -name entries -print0 | x-del-p
} 2>/dev/null
find .local/share/flatpak/repo/tmp/cache -type f -delete
find .cache/ccache /var/cache/ccache -mindepth 2 -type f -delete
find -maxdepth 5 -path '*minikube/cache' -print0 | x-del-p
find -maxdepth 5 -path '*ccache/?' -print0 | x-del-p
find -maxdepth 5 -path '*cargo/registry' -print0 | x-del-p
find -maxdepth 5 -path '*opam/default' -print0 | x-del-p
find -maxdepth 5 -path '*docker/machine/machines/minikube' -print0 | x-del-p
find -maxdepth 5 -path '*docker/machine/cache' -print0 | x-del-p