1

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?

8

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

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

5

Use stat dirname - just to be different!

  • 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
1

Use the -d option:

ls -ld dirname
  • Ho, you beat by 13s me this time ;) – radius Jun 23 '10 at 23:35
1

use the d flag

ls -ld directory_name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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