Viewing only Directories

I am Using Fedora and i want to see only directories

I am using ls -lad but it is only showing me the current directory.
SO What should I do??
Sanchit [ Mo, 21 Januar 2008 18:20 ] [ ID #1912863 ]

Re: Viewing only Directories

Sanchit wrote:
> I am Using Fedora and i want to see only directories
>
> I am using ls -lad but it is only showing me the current directory.
> SO What should I do??
find . -type d -| xargs ls -lad

Bye, Jojo
Joachim Schmitz [ Mo, 21 Januar 2008 18:39 ] [ ID #1912864 ]

Re: Viewing only Directories

Joachim Schmitz wrote:
> Sanchit wrote:
> > I am Using Fedora and i want to see only directories
> >
> > I am using ls -lad but it is only showing me the current directory.
> > SO What should I do??
> find . -type d -| xargs ls -lad
>
> Bye, Jojo

Thanks!
Sanchit [ Mo, 21 Januar 2008 18:50 ] [ ID #1912865 ]

Re: Viewing only Directories

Sanchit scrisse:

> ... i want to see only directories I am using ls -lad
> ...

ls -al | grep ^d
mallin.shetland [ Mo, 21 Januar 2008 22:58 ] [ ID #1912869 ]

Re: Viewing only Directories

On 21 Gen, 22:58, "mallin.shetland" <mallin.shetl... [at] aol.com> wrote:
> Sanchit scrisse:
>
> > ... i want to see only directories I am using ls -lad
> > ...
>
> ls =A0-al | grep ^d

Joachim Schmitz wrote:
> Sanchit wrote:
> > I am Using Fedora and i want to see only directories
> > I am using ls -lad but it is only showing me the current directory.
> > SO What should I do??
find . -type d -| xargs ls -lad
find: -: unknown option
I do not understand why is not in posix format under macosx,dammed
franzi [ Mo, 21 Januar 2008 23:31 ] [ ID #1912871 ]

Re: Viewing only Directories

On Jan 22, 6:31 am, franzi <hazz... [at] gmail.com> wrote:
> On 21 Gen, 22:58, "mallin.shetland" <mallin.shetl... [at] aol.com> wrote:
>
> > Sanchit scrisse:
>
> > > ... i want to see only directories I am using ls -lad
> > > ...
>
> > ls -al | grep ^d
> Joachim Schmitz wrote:
> > Sanchit wrote:
> > > I am Using Fedora and i want to see only directories
> > > I am using ls -lad but it is only showing me the current directory.
> > > SO What should I do??
>
> find . -type d -| xargs ls -lad
> find: -: unknown option
> I do not understand why is not in posix format under macosx,dammed

remove the "-" after the "d".
find . -type d | xargs ls -lad
mik3l3374 [ Di, 22 Januar 2008 04:22 ] [ ID #1913563 ]

Re: Viewing only Directories

On Jan 22, 1:20 am, Sanchit <sanchitgupt... [at] gmail.com> wrote:
> I am Using Fedora and i want to see only directories
>
> I am using ls -lad but it is only showing me the current directory.
> SO What should I do??

ls -p|grep "/"
mik3l3374 [ Di, 22 Januar 2008 04:23 ] [ ID #1913564 ]

Re: Viewing only Directories

franzi wrote:
> On 21 Gen, 22:58, "mallin.shetland" <mallin.shetl... [at] aol.com> wrote:
>> Sanchit scrisse:
>>
>>> ... i want to see only directories I am using ls -lad
>>> ...
>>
>> ls -al | grep ^d
>
> Joachim Schmitz wrote:
>> Sanchit wrote:
>>> I am Using Fedora and i want to see only directories
>>> I am using ls -lad but it is only showing me the current directory.
>>> SO What should I do??
> find . -type d -| xargs ls -lad
> find: -: unknown option
That additional - was a typo of mine...

> I do not understand why is not in posix format under macosx,dammed

Bye, Jojo
Joachim Schmitz [ Di, 22 Januar 2008 08:06 ] [ ID #1913567 ]

Re: Viewing only Directories

On Jan 21, 10:20=A0pm, Sanchit <sanchitgupt... [at] gmail.com> wrote:
> I am Using Fedora and i want to see only directories
>
> I am using ls -lad =A0but it is only showing me the current directory.
> SO What should I do??

try this : ls -l | grep ^d (or) ls -Rl | grep ^d
ashokpj [ Di, 22 Januar 2008 10:43 ] [ ID #1913569 ]

Re: Viewing only Directories

ashokpj [at] gmail.com writes:

> On Jan 21, 10:20 pm, Sanchit <sanchitgupt... [at] gmail.com> wrote:
> > I am Using Fedora and i want to see only directories
> >
> > I am using ls -lad  but it is only showing me the current directory.
> > SO What should I do??
>
> try this : ls -l | grep ^d (or) ls -Rl | grep ^d

You can also get the names and sizes of the directories by the "du" command.
Maxwell Lol [ Di, 22 Januar 2008 11:46 ] [ ID #1913570 ]

Re: Viewing only Directories

On Mon, 21 Jan 2008 09:20:30 -0800 (PST), Sanchit wrote:
> I am Using Fedora and i want to see only directories
>
> I am using ls -lad but it is only showing me the current directory.
> SO What should I do??

ls -ld -- */ .*/

will work in most shells. Wether "." and ".." are output is
shell dependant.

In zsh:

ls -ld -- *(D/)

(D) to include dot files.
(/) to select directories only.
(note that zsh won't expand "." and ".." there).

If you're also interested in symlinks to directories:

ls -Lld -- *(D-/)

--
Stephane
Stephane CHAZELAS [ Di, 22 Januar 2008 13:45 ] [ ID #1913572 ]

Re: Viewing only Directories

if you just want the directory names without the long format:

ls -F | grep '/$'

If you have the markdirs option on, you can also use:

ls -d */
hyperboogie [ Di, 22 Januar 2008 15:42 ] [ ID #1913579 ]

Re: Viewing only Directories

On Tue, 22 Jan 2008 06:42:25 -0800 (PST), hyperboogie wrote:
> if you just want the directory names without the long format:
>
> ls -F | grep '/$'
>
> If you have the markdirs option on, you can also use:
>
> ls -d */

markdirs, which is a zsh option only, is only to add a "/" upon
the filename generation to the directory names.

ls -d */

will work regardless of the markdirs option in most shells..

However, the above will not work correctly if some of the
directory names start with "-", hence:

ls -d -- */

(it won't list hidden dirs).

See also:

printf '%s\n' */

(as globbing is doing the directory listing, ls is no longer
required).

--
Stephane
Stephane CHAZELAS [ Di, 22 Januar 2008 15:58 ] [ ID #1913583 ]

Re: Viewing only Directories

Sanchit <sanchitgupta.1 [at] gmail.com> writes:

> I am Using Fedora and i want to see only directories
>
> I am using ls -lad but it is only showing me the current directory.
> SO What should I do??

ls -lad */

--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
Michal Nazarewicz [ Mi, 23 Januar 2008 22:26 ] [ ID #1914228 ]

Re: Viewing only Directories

Stephane Chazelas <stephane_chaze... [at] yahoo.fr> wrote:
> hyperboogie wrote:
> ...
> markdirs, which is a zsh option only, is only to add a "/" upon
> the filename generation to the directory names.
> ...

ksh(1) version 1988 and newer implements a "markdirs" shell option:

set -o markdirs

=Brian
brian_hiles [ Fr, 25 Januar 2008 21:38 ] [ ID #1915931 ]
Linux » comp.unix.shell » Viewing only Directories

Vorheriges Thema: Array variables getting lost
Nächstes Thema: switching user in shell