How to sort by size in reverse?

0140

To sort files by size in reverse order in Bash, you can use the ls command with specific options. Here’s how to do it:

Command:

ls -lSr

Breakdown:

  • ls: Lists files and directories.
  • -l: Provides a detailed listing (long format).
  • -S: Sorts the files by size.
  • -r: Reverses the order of the sort, so the smallest files are listed first.

Example:

Running ls -lSr will display files in the current directory sorted by size, with the smallest files listed first.

If you want to include hidden files as well, you can use:

ls -laSr

If you have any more questions or need further assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!