Monday, August 4, 2008

[bash]Which file takes the most of the space

I was just asked to investigate on a problem.
None of the user could not log in to our application that uses OpenLDAP.
We restarted the slapd daemon, had a look at /var/log/apache2/error.log but nothing showed up. Weird
A sample df -h showed me that the available amount of space was 0% :(.
So to find out which file takes most of the space, run the command:

find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'

and it will return the name of the file and its size.
Tip found here