On Fri, 9 Feb 2001, Stan Isaacs wrote:
> I teach a class in (very) beginning UNIX, using Redhat
> Linux, version 6.?. In one exercise, the book (I use
> Sobells' "Practical Guide to Linux") asks students to list
> files in a directory by size. I try to get them to use ls
> -l, and pipe it through sort, since size in blocks is not
> very useful for beginning users. First there seems to be
> a new "-S" flag which does sort in bytes (where did that
> come from? Though I think it is very useful.)
>
> But recently, a student showed me
>
> ls -sort -S
>
> and I was very surprised to see that it seemed to work!
> It gave a long listing in sorted order on bytes. I've
> never heard of a "-sort" parameter to ls, nor does it seem
> to follow any standards. I would understand better if it
> said "ls --sort C" (or something, which specified
> characters.) Is this a new syntax? Is it general, or
> special to "ls"? Are we going to be able to combine
> commands at random in the future? What about "ls -wc", a
> usage many students seem to try on quizes!
This is not what it seems:
ls -sort -S
The above line is the same as:
ls -s -o -r -t -S
where:
-s, --size
Print the size of each file in 1K blocks to
the left of the file name. If the
environment variable POSIXLY_CORRECT is set,
512-byte blocks are used instead.
-o use long listing format without group info.
-r, --reverse
Sort directory contents in reverse order.
-t, --sort=time
Sort directory contents by timestamp
instead of alphabetically, with the newest
files listed first.
-S, --sort=size
Sort directory contents by file size instead
of alphabetically, with the largest
files listed first.
This is not new, as the above was taken from a RedHat v4.2
system.
--
John Darrah (u05192) | Dept: N/C Programming
Giddens Industries | Ph: (425) 353-0405 #229
PO box 3190 | Ph: (206) 767-4212 #229
Everett WA 98203 | Fx: (206) 764-9639
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list