CentOS下清除系统日志
-
CentOS 6
cat /dev/null > /var/log/boot.log cat /dev/null > /var/log/btmp cat /dev/null > /var/log/cron cat /dev/null > /var/log/dmesg cat /dev/null > /var/log/dracut.log cat /dev/null > /var/log/lastlog cat /dev/null > /var/log/maillog cat /dev/null > /var/log/messages cat /dev/null > /var/log/secure cat /dev/null > /var/log/spooler cat /dev/null > /var/log/tallylog cat /dev/null > /var/log/wtmp cat /dev/null > /var/log/yum.log
-
CentOS 7
cat /dev/null > /var/log/boot.log cat /dev/null > /var/log/btmp cat /dev/null > /var/log/cron cat /dev/null > /var/log/dmesg cat /dev/null > /var/log/firewalld cat /dev/null > /var/log/grubby cat /dev/null > /var/log/lastlog cat /dev/null > /var/log/mail.info cat /dev/null > /var/log/maillog cat /dev/null > /var/log/messages cat /dev/null > /var/log/secure cat /dev/null > /var/log/spooler cat /dev/null > /var/log/syslog cat /dev/null > /var/log/tallylog cat /dev/null > /var/log/wpa_supplicant.log cat /dev/null > /var/log/wtmp cat /dev/null > /var/log/yum.log
-
清除Centos系统用户登录记录和命令记录
echo > /var/log/wtmp #清除用户登录记录和命令记录 echo > /var/log/btmp echo > /var/log/secure #如果没有这个文件,重启syslog进程service syslog restart echo > .bash_history history -c #清除命令记录
-
清除其它文件(Debian系统)
sudo apt-get autoclean 清理旧版本的软件缓存 sudo apt-get clean 清理所有软件缓存 sudo apt-get autoremove 删除系统不再使用的孤立软件
文章有(2)条网友点评
你确定这是centos的命令吗。。。
@ eee 唔,最后的清除其它文件操作是Debian(Ubuntu)的,用于清理apt…其他是cent os的没错,这几个命令主要是将日志、记录文件清空…