A Way to Find Files That Are Too Large That Take Up Disk Space on RHEL 7
Good afternoon everyone, Again, I was given the opportunity to write this insignificant article or note.
This time I will share a way to find files that are too large that take up disk space on the server. I usually use this method to find and delete these large files.
It's very risky when the hard disk on the server is full, especially up to 100% and it's on the root partition.
Find Large Files
To find large files, you can write the command below:
# find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
Or you want to enlarge the size you want to find, you can increase the size, for example:
# find / -type f -size +500M -exec ls -lh {} \; | awk '{ print $NF ": " $5 }'
Find Large Files |
Delete File
If the file found is a log and you want to empty the file without deleting it you can use this command:
# cat /dev/null > /var/log/nginx.log
And when you want to delete the file, just delete the file that takes up the size on the partition:
# rm /root/zend-server.tgz
You just have to see the results of your cleansing, whether they are appropriate or still lacking and need to be cleaned again.
# df -h
Delete File |
So that's how to find large files and delete them so that our partitions on the server are looser.
Maybe that's all I can share with you, I hope this article can help you all.
Thank you.
Post a Comment for "A Way to Find Files That Are Too Large That Take Up Disk Space on RHEL 7"