首页 / 话题 / 服务器 / 文章详情

CentOS系统磁盘空间占满清空系统日志方法

一直在的 2022-09-03 | 阅读(1259) | 评论(0

使用CentOS系统的时候,经常会遇到系统日志文件非常大导致磁盘空间占满的情况,如果直接删除,会导致日志错误,不再生成日志,这时,我们可以使用下面的方法清空日志。

查看硬盘占用代码:

 <span class="hljs-attribute">df</span> -h
CentOS 6系统:

<a target="_blank" href="https://www.ymkuz.com/tag/790.html" title="View all posts in cat">cat</a> /<a target="_blank" href="https://www.ymkuz.com/tag/791.html" title="View all posts in dev">dev</a>/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/<a target="_blank" href="https://www.ymkuz.com/tag/789.html" title="View all posts in log">log</a>/boot.log
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/btmp
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/cron
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/dmesg
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/dracut.log
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/lastlog
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/maillog
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/messages
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/secure
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/spooler
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/tallylog
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/wtmp
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/yum.log 
CentOS 7系统:

cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/boot.log
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/btmp
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/cron
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/dmesg
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/firewalld
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/grubby
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/lastlog
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/mail.info
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/maillog
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/messages
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/secure
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/spooler
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/syslog
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/tallylog
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/wpa_supplicant.log
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/wtmp
cat /dev/<span class="hljs-literal">null</span> > /<span class="hljs-keyword">var</span>/log/yum.log 

相关阅读
评论(0)
请登录
请登录后发表评论