Removing files that used most space
By yuli - Posted on May 4th, 2008
Today I had the following problem. One of the production servers whent out of free disk space. I had to delete few big files and directories. I decided to compose this post to cover basic steps you can use to find files that use the most space.
I use the following command to find disk usage of the existing directory:
du -ch ./
- -c - produce a grand total
- -h - print sizes in human readable format (e.g., 1K 234M 2G)
In case you have too many files, you can redirect the output to a file like the following:
du -ch ./ > result.txt
Next step is to filter directories and find those wich use most of the space.
I used the following simple regular expression to filter those records had GB size.:
cat result.txt | grep -E [0-9]G
