Linux – How to find largest files in a dir – ignoring directory sizes

awkdulinuxls

I want to do something like this

du -a | sort -rn | head

But I want to extract files only, ignoring directories.

To be clear, I want to traverse through all sub-directories but I don't want to find directory sizes. Just files sizes.

UPDATE

I also want to return the full path of the files

Best Answer

This should work:

find <path> -type f -exec du -a{} + | sort -rn | head

Taken from http://unix-linux.itags.org/q_unix-linux-programming_84920.html