[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ls -s but sorted
From: |
James Youngman |
Subject: |
Re: ls -s but sorted |
Date: |
Fri, 8 Aug 2008 08:25:01 +0100 |
On Fri, Aug 8, 2008 at 4:50 AM, <address@hidden> wrote:
> ls man page says
> -s, --size
> print the size of each file, in blocks
>
> -S sort by file size
> but to sort by block size (not always the same as file size due to
> files with holes), one must do
> ls -s|sort -n
I agree.
~/tmp$ find . -printf '%7S %10s %4b %p\n'
1 4096 8 .
2.4e-05 512000512 24 ./foo
1 32768 64 ./nohole
1.04 102400 208 ./bigger-nohole
~/tmp$ ls -lhs
total 148K
104K -rw-r--r-- 1 james james 100K 2008-08-08 08:25 bigger-nohole
12K -rw-r--r-- 1 james james 489M 2008-08-08 08:18 foo
32K -rw-r--r-- 1 james james 32K 2008-08-08 08:19 nohole
~/tmp$ ls -s1S
total 148
12 foo
104 bigger-nohole
32 nohole
~/tmp$ ls -s1Sl
total 148
12 -rw-r--r-- 1 james james 512000512 2008-08-08 08:18 foo
104 -rw-r--r-- 1 james james 102400 2008-08-08 08:25 bigger-nohole
32 -rw-r--r-- 1 james james 32768 2008-08-08 08:19 nohole
So from the above it looks like "ls" is doing just what the
documentation says it should. What are you suggesting should be
changed?
James.