#!/bin/bash ######################################################################### # Script for cleaning logs # # Created by DoIT # # ver 0.6 # ######################################################################### echo -e "- [\e[1;33mCleaning\e[0m] logs and history" HIS=$(find /home/ -name .bash_history) for h in $HIS; do rm -rf $h; done rm -rf /root/.bash_history rm -rf /opt/log2ram* find /var/log/ -name "*.gz" -type f -delete find /var/log/ -name "*.log.*" -type f -delete find /var/log/ -name "*.[0-9]*" -type f -delete test -d /var/lib/clamav && rm -rf /var/lib/clamav/tmp* history -c echo -e "- [\e[1;33mCleaning\e[0m] APT archives" apt autoclean > /dev/null 2>&1 apt clean > /dev/null 2>&1 apt autoremove -y > /dev/null 2>&1 pip cache purge > /dev/null 2>&1 echo -e "- [\e[1;33mCleaning\e[0m] Journal" journalctl --vacuum-size=100M > /dev/null 2>&1 echo -e "- [\e[1;32mActual size\e[0m] of partition" df -h | grep -v tmpfs | sed 's/ on//g'