82 lines
1.9 KiB
Bash
Executable File
82 lines
1.9 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 logs"
|
|
sudo du -hs /var/log
|
|
sudo rm -rf /var/log/**.gz
|
|
sudo rm -rf /var/log/**.[1-9]
|
|
sudo du -hs /var/lib/docker/containers/*/*-json.log
|
|
sudo rm -rf /var/lib/docker/containers/*/*-json.log
|
|
|
|
echo "clearing apache logs"
|
|
sudo du -hs /etc/apache2/logs
|
|
sudo find /etc/apache2/logs -type f -delete
|
|
sudo du -hs /etc/apache2/logs
|
|
|
|
echo "clearing nginx logs"
|
|
sudo du -hs /etc/nginx/logs
|
|
sudo find /etc/nginx/logs -type f -delete
|
|
sudo du -hs /etc/nginx/logs
|
|
|
|
# remove temp things
|
|
sudo du -hs /var/lib/systemd/coredump/
|
|
sudo rm -rf /var/lib/systemd/coredump/*
|
|
sudo rm -rf ~/.xsession-errors*
|
|
sudo rm -rf ~/.config/doublecmd/doublecmd.err
|
|
sudo rm -rf ~/.mozilla/firefox/Crash\ Reports/
|
|
|
|
|
|
# empty trash
|
|
sudo rm -rf ~/.local/share/Trash/*
|
|
sudo rm -rf /root/.local/share/Trash/*
|
|
sudo rm -rf /.Trash-1000
|
|
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
|
|
|
|
|
|
# remove nohup
|
|
sudo rm -rf /home/*/nohup.out
|
|
|
|
|
|
# prune unused docker images
|
|
sudo docker system prune -a -f
|
|
|
|
|
|
# vacuum firefox
|
|
kill -9 firefox
|
|
cd ~/.mozilla/firefox/dym/
|
|
du -hs ~/.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
|
|
du -hs ~/.mozilla/firefox/dym/
|
|
|
|
|
|
# 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`
|