How to find large files/folders on Linux shell

From Computing, Technology, HowTo Wiki

Jump to: navigation, search

Files

Use the following command to find large files on a linux filesystem:

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


Folders

To find large directories on a linux filesystem try the following:

du -h / | grep ^[0-9.]*G

find / -type d -size +1G


To find the top 10 largest directories:

du -a / | sort -n -r | head -n 10

du -ks / | sort -n -r | head -n 10