I want to see similar output like:

ls -l /etc/php5/php.ini

Which would give me:

-rw-r--r-- 1 root root 40344 Jun 14 14:33 /etc/php5/php.ini

Except the file in question is a directory, and doing ls -l on it would list it's contents.

How can I have it give me that permissions/info for a directory, or is there a better way?

link|improve this question

78% accept rate
feedback

4 Answers

up vote 8 down vote accepted

Use ls -ld for directories. Quoting from the man page:

-d, --directory
list directory entries instead of contents, and do not dereference symbolic links

link|improve this answer
feedback

Use stat dirname - just to be different!

link|improve this answer
1  
+1 for originality ;) – Jacek Konieczny Jun 24 '10 at 6:31
Here's another one just to be different: find /path/to/parent/dir -maxdepth 1 -type d -name dirname -ls – Dennis Williamson Jun 25 '10 at 2:30
feedback

Use the -d option:

ls -ld dirname
link|improve this answer
Ho, you beat by 13s me this time ;) – radius Jun 23 '10 at 23:35
feedback

use the d flag

ls -ld directory_name
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.