Date: Wed, 06 Mar 2002 13:57:04 +0000 From: Wes Peters <wes@softweyr.com> To: arch@freebsd.org Subject: Sorting and Matching options for ls(1) Message-ID: <3C862030.9080108@softweyr.com>
next in thread | raw e-mail | index | archive | help
At the request of several FreeBSD users, I have developed the following
two options for ls(1):
-M Display files that match the specified types only. The file
types are specified by a single character as in strmode(3), with
the option to specify regular files as ``r'' instead of ``-'' if
needed.
-S Explicity specify the sorting order. The sorting flags are:
0 No sorting.
n Sort by filename (default).
u File owner user id.
g File owner group id.
s File size.
a File access time (same as -u but does not modify printed
output).
c File change time (same as -c but does not modify printed
output).
m File modification time (same as -t but does not modify
printed output).
t File type, sorted in lexical order as displayed by
strmode(3).
The -S options change only the sorting order, so it is possible
to list the change time while sorting by the access time with:
ls -l -c -Sa
The code to accomplish both of these adds only 1788 bytes to /bin/ls.
The option keyletters S (for Sort) and M (for Match) were carefully
chosen to be mnemonic while not conflicting with recent Posix standards
or with GNU ls.
My current patch against 4.5-RELEASE is available at
ftp://softweyr.com/pub/softweyr/ls.diff
I plan to create a patch against -CURRENT today or tomorrow. Suggestions,
comments, and "don't do thats" all welcome. I hope to achieve enough
consensus to commit this in the next few days, as I am going to be quite
busy for the next few weeks starting this Sunday.
Thank you.
--
"Where am I, and what am I doing in this handbasket?"
Wes Peters Softweyr LLC
wes@softweyr.com http://softweyr.com/
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C862030.9080108>
