Peng Yu wrote:
> I don't see an option that sorts ls result by file size. Could
> somebody let me know if there is such an option?

Of course sorting is in the domain of the sort program.  Try this:

  ls -log | sort -k 3n,3

Or with sort 7.5 or newer you can sort using human sizes.

  ls -logh | sort -k 3h,3

But this feature is built into ls.  See the --sort=WORD documentation.

  info coreutils 'ls invocation'

Try these:

  ls -log --sort=size

  ls -logh --sort=size

  ls -Slogh

This is probably my preferred one.

  ls -Srlogh

Bob


Reply via email to