Re: simple ls question On Mon, 11 Feb 2008 16:29:51 +0000, ray wrote:
> Loki Harfagr wrote:
>> Mon, 11 Feb 2008 15:06:04 +0000, ray did cat :
>>
>>> what's the easiest way to just list directories?
>>>
>>> the shortest way I can do is
>>> ls -p | grep /
>>>
>>> if I do
>>> ls -d
>>> all I get is
>>
>> Using lsd you should have stars in your eyes ;-) So, what about:
>> $ ls -d *
>
> rjoyal@filebox:/tmp$ ls
> total 0
> drwxr-xr-x 2 rjoyal raynic 48 2008-01-23 23:23 vx/ drwxr-xr-x 2 rjoyal
> raynic 48 2008-01-23 23:23 x/ -rw-r--r-- 1 rjoyal raynic 0 2008-02-11
> 10:28 x.x
>
> rjoyal@filebox:/tmp$ ls -d
> drwxrwxrwt 6 root root 184 2008-02-11 10:28 ./
>
> rjoyal@filebox:/tmp$ ls -d *
> drwxr-xr-x 2 rjoyal raynic 48 2008-01-23 23:23 vx/ drwxr-xr-x 2 rjoyal
> raynic 48 2008-01-23 23:23 x/ -rw-r--r-- 1 rjoyal raynic 0 2008-02-11
> 10:28 x.x
>
> so, no, ls -d * doesn't work.
>
> I want this:
> drwxr-xr-x 2 rjoyal raynic 48 2008-01-23 23:23 vx/
> drwxr-xr-x 2 rjoyal raynic 48 2008-01-23 23:23 x/
> (the directories only.)
>
> Ray
OK! I read and replied too fast :-)
Then, would that one be alright?:
$ ls -d */
and the usual extensions will fit:
$ ls -ld */
$ ls -lad */
If I bench it that seems fine (apart the cosmetics on // but
don't worry about that as one is all and all is one):
-----------
$ cd /dev/shm/ && mkdir a bb ccc && touch A BB CC a/inA bb/inBB
$ ls -d */
a// bb// ccc// qemu//
$ ls -ld */
drwxr-xr-x 2 loki users 60 2008-02-11 19:15 a//
drwxr-xr-x 2 loki users 60 2008-02-11 19:15 bb//
drwxr-xr-x 2 loki users 40 2008-02-11 19:15 ccc//
drwxrwx--- 2 root vmvare 40 2008-02-11 18:40 qemu//
----------- |