61 lines
1.4 KiB
Bash
Executable File
61 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env zsh
|
|
|
|
# purge memory
|
|
free -h
|
|
|
|
echo "clearing memory"
|
|
sudo sync
|
|
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
|
|
free -h
|
|
|
|
|
|
# clear logs
|
|
echo "clearing /var/log"
|
|
sudo du -hs /var/log
|
|
sudo find /var/log -type f -delete
|
|
sudo du -hs /var/log
|
|
|
|
# remove temp things
|
|
rm -rf /var/lib/systemd/coredump/*
|
|
|
|
echo "clearing /etc/apache2/logs"
|
|
sudo du -hs /etc/apache2/logs
|
|
sudo find /etc/apache2/logs -type f -delete
|
|
sudo du -hs /etc/apache2/logs
|
|
|
|
rm ~/.xsession-errors*
|
|
rm ~/.config/doublecmd/doublecmd.err
|
|
rm ~/.mozilla/firefox/Crash\ Reports/
|
|
|
|
# empty trash
|
|
rm -rf ~/.local/share/Trash
|
|
sudo rm -rf /root/.local/share/Trash/*
|
|
sudo rm -rf /[A-Z]*/.Trash-1000
|
|
sudo rm -rf /media/*/.Trash-1000
|
|
sudo rm -rf /media/*/*/.Trash-1000
|
|
sudo rm -rf /mnt/*/.Trash-1000
|
|
sudo rm -rf /mnt/*/*/.Trash-1000
|
|
# rm -rf /_servers/*/.Trash-1000
|
|
|
|
# vacuum firefox
|
|
kill -9 firefox
|
|
cd ~/.mozilla/firefox/dym/
|
|
find -maxdepth 1 -type f \
|
|
| xargs file -F "" \
|
|
| awk '/SQLite/{print $1}' \
|
|
| xargs -n 1 -I FILE bash -c \
|
|
'echo Vacuuming $1; sqlite3 $1 "vacuum;"' \
|
|
bash FILE
|
|
|
|
#Cleaning the old kernels
|
|
dpkg-query -l | grep 'linux-im*'
|
|
#dpkg-query -l | grep linux-im* | awk '{print $2}'
|
|
|
|
sudo apt-get purge -y $(dpkg -l 'linux-*' \
|
|
| sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | head -n -1) \
|
|
--assume-yes
|
|
|
|
sudo apt-get install -y linux-headers-`uname -r \
|
|
|cut -d'-' -f3`-`uname -r \
|
|
|cut -d'-' -f4`
|