Centos Clean Disk Space

First of all clean the logs folder

check whole disk space
df -h

-------------------------

check in folder combined
du -sh

-------------------------

check in folder individual files/fodlers
du -sh *

-------------------------

find / -type f -size +20M -exec ls -lh {} \; | awk '{ print $NF ": " $5 }'

---------------------
find /var/log -type f -delete

-------------------
cat /dev/null > /var/log/nginx/error.log
cat /dev/null > /var/log/messages

----------------------


Clear all log files
for i in /var/log/*; do cat /dev/null > $i; done
for i in /var/log/nginx/*; do cat /dev/null > $i; done
for i in /var/log/httpd/*; do cat /dev/null > $i; done
for i in /var/log/cwp/*; do cat /dev/null > $i; done
for i in /var/log/mysql/*; do cat /dev/null > $i; done
for i in /var/log/audit/*; do cat /dev/null > $i; done


Dated : 2020-10-13 18:58:10

Category : Server handling

Tags : Server handling Centos

Leave Your Comment

Related Posts