US Trends

what is the ls option to sort by file size?

The ls option to sort by file size is uppercase -S. Common useful variants:

  • ls -S – sort by size, largest first.
  • ls -lS – long listing, sorted by size.
  • ls -lhS – long listing, human-readable sizes (K, M, G), sorted by size.
  • ls -lSr – sort by size, smallest first (adds -r for reverse order).