Linux的文件系統比Windows的要優秀,不會產生碎片,對於長時間運行的服務器來說尤為重要,而且Linux系統本身也不會像Windows一樣產生大量的垃圾文件。不知道這個說法有沒有可信度!至少我們可以確定的是linux系統的文件系統是比較優秀的!
錯誤
rm -f logfile  
原因
應用已經打開文件句柄,直接刪除會造成:
1.應用無法正確釋放日誌文件和寫入
2.顯示磁盤空間未釋放
正確
cat /dev/null > logfile
把一下代碼保存為.sh後綴腳本來運行即可清除Linux系統日誌
#!/bin/sh
cat /dev/null > /var/log/syslog
cat /dev/null > /var/adm/sylog
cat /dev/null > /var/log/wtmp
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/messages
cat /dev/null > /var/log/openwebmail.log
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/secure
cat /dev/null > /var/log/httpd/error_log
cat /dev/null > /var/log/httpd/ssl_error_log
cat /dev/null > /var/log/httpd/ssl_request_log
cat /dev/null > /var/log/httpd/ssl_access_log
另外清理linux系統垃圾還有以下命令
sudo apt-get autoclean 清理舊版本的軟件緩存
sudo apt-get clean 清理所有軟件緩存
sudo apt-get autoremove 刪除系統不再使用的孤立軟件

文章標籤
全站熱搜
創作者介紹
創作者 成功运行 的頭像
成功运行

成功运行的部落格

成功运行 發表在 痞客邦 留言(0) 人氣(6,721)