ls -d command question

Introduction to UNIX/Linux (70037) - Jim Griffin
Forum rules
Be nice to each other!
Locked
JoAnne Brewer
Posts: 5
Joined: Wed Feb 09, 2011 2:38 pm

ls -d command question

Post by JoAnne Brewer » Fri Mar 04, 2011 1:58 pm

I had the ls -d command/option in my notes as a command to use to see the permissions of the Poems folder
when it was entered like this: $ ls -d Poems. When I did this again today I Just got "Poems" as a response, nothing
showing permissions. I was expecting to see something like drw-r--r-- in the output not just "Poems". Is "-d" the
incorrect option? In my home directory, where Poems is, I could do ls -l and see the permissions of the Poems
directory. I understand that ls -l Poems shows permissions of the files it contains not the permissions of the Poems
directory itself. Anyone else know about this?
Thanks,
JoAnne

User avatar
Gabriel Vistica
Posts: 213
Joined: Tue Feb 09, 2010 6:06 pm
Location: Sonora, CA

Re: ls -d command question

Post by Gabriel Vistica » Fri Mar 04, 2011 4:48 pm

You could always do 'ls -ld Poems' for a long listing of the directory itself (not its contents)...

User avatar
Jim Griffin
Site Admin
Posts: 340
Joined: Tue Jan 12, 2010 8:52 pm
Location: Cabrillo College
Contact:

Re: ls -d command question

Post by Jim Griffin » Fri Mar 04, 2011 9:30 pm

Yes,
the -d option tells the ls command to list just the directory and not the contents of the directory.
To see the permissions and file size etc, you need to use the -l option. So, these two options go along together:
ls -ld Poems

Jim G.

JoAnne Brewer
Posts: 5
Joined: Wed Feb 09, 2011 2:38 pm

Re: ls -d command question

Post by JoAnne Brewer » Sat Mar 05, 2011 10:43 am

Thanks for the answers!
-JoAnne

Locked

Return to “CIS 90 (classroom) - Spring 2011”