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

Re: ls'ing dirs before files



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.

</nori>

-- 
    .~.      nori @ sccs.swarthmore.edu 
    /V\  http://www.sccs.swarthmore.edu/~nori/jnl/daily.html
   // \\          @ maenad.net
  /(   )\       www.maenad.net
   ^`~'^

Attachment: pgpQkn1oHrTBO.pgp
Description: PGP signature


Reply to: