I have used
du -a | sort -nr | head -n 10
but it includes directories.
To exclude all directories, I tried using find.
find -type f -exec ls -l {} \; | tr -s ' ' | cut -d' ' -f 5,9- | sort -rn | head -n 10
Explanation
- -type f means only look at files
- -exec ls -l {} \; means to show a long listing for each matched file
- tr -s ' ' replaces multiple occurrences of space with one space
- cut -d' ' -f 5,9- sets the delimiter to space and displays the columns 5 and everything after 8. Column 5 is the size, everything after 8 is the file name (with possible embedded spaces)
No comments:
Post a Comment