清除日誌文件

分享于 

1分钟阅读

ubuntu

  简体

问题:

我有以下日志文件:


72K /var/log/dist-upgrade


4.0K /var/log/samba/cores/smbd


4.0K /var/log/samba/cores/nmbd


12K /var/log/samba/cores


84K /var/log/samba


44K /var/log/gdm


4.0K /var/log/bittorrent


1.6M /var/log/installer


4.0K /var/log/asterisk/cdr-custom


19M /var/log/asterisk/cdr-csv


1.2G /var/log/asterisk


4.0K /var/log/apparmor


4.0K /var/log/unattended-upgrades


36K /var/log/cups


4.0K /var/log/news


120K /var/log/proftpd


12K /var/log/fsck


28K /var/log/apt


1.2G /var/log



如何清理这些日志文件?


答案1:

打开终端,CTRL+ALT+T,并运行:

 
sudo rm /var/log/*



删除特定的日志文件运行:


sudo rm /var/log/*nameoflogfile*.log 




答案2:

简单的日志清理


sudo /etc/cron.daily/logrotate



# optionnal, delete log archives


sudo find /var/log -type f -iname *.gz -delete





文件  files  log  log-files