Linux Finding Directory with large number of files
I recently ran into an issue where there was some new software running which was writing a lot of trace files which was causing my disk space to be full. I was not sure which directory it was writing it in so I googled for a script and found this
https://unix.stackexchange.com/questions/122854/find-the-top-50-directories-containing-the-most-files-directories-in-their-first
I ran the following command and it found the offending directory in 2 mins.
du --inodes -S | sort -rh | sed -n \
'1,50{/^.\{71\}/s/^\(.\{30\}\).*\(.\{37\}\)$/\1...\2/;p}'
Comments