#!/Bashblog.net

How to find largest files and folders

Categories: [1-liners]
Tags: [bash]

In order to find which files or folders clutter your server disk space, you can use this little command:

du -k ./* | sort -nr | cut -f2 | xargs -d '\n' du -sh | less

As a bonus, you want to look at inodes and find where the most files reside:

for i in $(ls -1A); do echo "$(find $i | sort -u | wc -l) $i"; done | sort -rn | head -5

Next »