DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

List Largest Files Recursively in a Folder


In shell, to list the files in a folder recursively ordered by size (excluding sub-folders), run the following command: find . -type f -exec du -h -a {} + | sort -hr | head

See Using semicolon (;) vs plus (+) with exec in find for the meaning of {} and + in the exec clause of find command.

Verified in bash and zsh.



Published

Dec 30, 2017

Last Updated

Dec 30, 2017

Category

Tech

Tags

  • files 2
  • shell 46
  • size 1

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor