how to list file and sort by filename using ls
Paul Lussier
p.lussier at comcast.net
Mon Apr 24 20:34:01 EDT 2006
Zhao Peng <greenmt at gmail.com> writes:
> Now I should say good afternoon :)
>
> Using either "ls -ul" or "ls -cl"(which are supposed to sort by name
> according to manual, if I understood and used correctly), I just can't
> list files and sort them by filenames.
Others have mentioned the values of various environment variables,
which is usualy my second place to look, the first being the man page
:)
DESCRIPTION
List information about the FILEs (the current directory by
default). Sort entries alphabetically if none of -cftuSUX
nor --sort.
The DESCRIPTION clearly states that the default behavior is to sort
listings alphabetically. *Furthermore*, it implies that and of
-cftuSUX or --sort *ALTER* the default output.
So, what do -c and -u do?
-c with -lt: sort by, and show, ctime (time of last modification of
file status information) with -l: show ctime and sort by name
otherwise: sort by ctime
-u with -lt: sort by, and show, access time with -l: show access
time and sort by name otherwise: sort by access time
So, there you have it, -c and -u, when used with -l do more than just
sort by name. -c sorts by ctime, -u sorts by name, then access time.
hth.
--
Seeya,
Paul
More information about the gnhlug-discuss
mailing list