Clean log scripts for armbian

作者: shaneZhang 分类: 互联网技术 发布时间: 2021-08-06 20:32

Below is the clean log script of ubuntu on armbian.


#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives

#Clean all the log file
#for logs in `find /var/log -type f`;  do > $logs; done

logs=`find /var/log -type f`
for i in $logs
> $i

#Getting rid of partial packages
apt-get clean && apt-get autoclean

#Getting rid of no longer required packages
apt-get autoremove -y

#Getting rid of orphaned packages
deborphan | xargs sudo apt-get -y remove --purge

#Free up space by clean out the cached packages
apt-get clean

# Remove the Trash
rm -rf /home/*/.local/share/Trash/*/**
rm -rf /root/.local/share/Trash/*/**

# Remove Man
rm -rf /usr/share/man/?? 
rm -rf /usr/share/man/??_*

#Delete all .gz and rotated file
find /var/log -type f -regex ".*\.gz$" | xargs rm -Rf
find /var/log -type f -regex ".*\.[0-9]$" | xargs rm -Rf

#Cleaning is completed
echo "Cleaning is completed"

本页面支持繁体中文友好显示:Clean log scripts for armbian



您的电子邮箱地址不会被公开。 必填项已用*标注