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

Re: ls'ing dirs before files



On Sat, Jul 27, 2002 at 05:08:15PM -0500, Gary Turner wrote:
> 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... :(
> 
> So now I'll read the FMs for sed and regex and maybe awk to see about
> reworking the sort order.  Don't wait up for me, Mom.  I'll be late.

Not to spoil the fun, but thought of using find, like:

    $ find `ls` -type d -maxdepth 0 && find `ls` -not -type d -maxdepth 0

-- 
groetjes, carel


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



Reply to: