平时不管是web还是系统产生的日志都可能导致洗盘爆满,所以我在这里分享一些基本常用清理linux日志的方法。
rm -rf /var/cache/*
echo > /var/log/wtmp
echo > /var/log/btmp
echo > /var/log/lastlog
echo > /var/log/secure
echo > /var/log/messages
echo > /var/log/syslog
echo > /var/log/xferlog
echo > /var/log/auth.log
echo > /var/log/user.log
cat /dev/null > /var/adm/sylog
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/openwebmail.log
cat /dev/null > /var/log/mail.info
cat /dev/null > /var/log/yum.log
cat /dev/null > /var/log/boot.log
cat /dev/null > /var/log/dmesg
echo > /var/run/utmp
echo > .bash_history
history -cw
评论 (0)