List all files and first level directories arranged by size on Linux

du -sh * | sort -hr

Where:

  • du -sh: Shows the sizes of files and directories in a human-readable format
  • sort -hr: Sorts the output by size in human format, with the largest items at the top.

Sample:

That’s it, Enjoy!

Unknown's avatar

About Ahmed Tawfik

Cybersecurity Professional, Systems Engineer, OSS & Linux Geek
This entry was posted in Linux and tagged , . Bookmark the permalink.

Leave a comment