How do I list files by size?

QuestionsQuestions8 SkillsProBasic Files OperationsSep, 23 2025
097

To list files by size in a Unix-like operating system, you can use the ls command with the -S option. Here's how to do it:

ls -lS

Explanation:

  • -l: Provides a detailed listing (permissions, owner, size, etc.).
  • -S: Sorts the files by size, with the largest files listed first.

If you want to include hidden files as well, you can combine it with the -a option:

ls -laS

This command will give you a detailed list of all files, including hidden ones, sorted by size. If you have any further questions, feel free to ask!

0 Comments

no data
Be the first to share your comment!