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

Re: ls'ing dirs before files



On Sat, 2002-07-27 at 18:18, Nori Heikkinen wrote:
> on Sat, 27 Jul 2002 05:08:15PM -0500, Gary Turner insinuated:
> > On Fri, 26 Jul 2002 23:03:43 +0200, martin f krafft wrote:
> > >sometime last year, the /bin/ls behaviour changed to sorting files
> > >and dirs interspersed. how can i make /bin/ls first list all dirs,
> > >then all files, and each of them sorted by filename within itself?
> > 
> > What a neat little opportunity for self-edification :)
> > 
> > My first thought was to do ls -l | sort.  That will order as
> > directory, link, and regular files, but mess up order within the
> > class, since permissions are next, then nodes, then owner, then...
> > :(
> 
> piping also strips away the color, if you're using that (`which ls` =
> ls: aliased to ls -F --color=auto).  and sort also doesn't deal with
> the interspersing of dot-files with non-dot-files, which /bin/ls
> started doing along with interspersing directories and files ...
> 
> not a problem over here, just a curiousity.  anyone let us know if you
> figure it out.

Doesn't "sort" have an option to collate on column "n"?  You
also may have to resort to Your Scripting Language Of Choice.

-- 
+-----------------------------------------------------------------+
| Ron Johnson, Jr.        Home: ron.l.johnson@cox.net             |
| Jefferson, LA  USA                                              |
|                                                                 |
| "The greatest dangers to liberty lurk in insidious encroachment |
|  by men of zeal, well-meaning, but without understanding."      |
|   Justice Louis Brandeis, dissenting, Olmstead v US (1928)      |
+-----------------------------------------------------------------+


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: