Linux: Find the largest files and directories

This command will list top 10 files and directories by size.

find / -printf '%s %p\n'| sort -nr | head -10

To find just the large files and skip the directories, run the following command

find / -type f -printf '%s %p\n'| sort -nr | head -10

 To fine the large files of a certain type, run the following command

find / -type f -iname "*.gz" -printf '%s %p\n'| sort -nr | head -10

An alternate way of finding out the biggest files and folders is:

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s