bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to ls (sorted by file size)?


From: Bob Proulx
Subject: Re: How to ls (sorted by file size)?
Date: Thu, 31 Dec 2009 10:18:43 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

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

[Prev in Thread] Current Thread [Next in Thread]