9

I want to see a long listing for a single directory. When I type ls -lha, I see this:

drwxrwxr-x  4 username groupname 4.0K 2010-08-05 09:55 files
drwxrwxr-x  7 username groupname 4.0K 2010-08-05 14:25 trunk
drwxrwxr-x  8 username groupname 4.0K 2010-08-05 16:02 phpincludes
drwxrwxr-x 11 username groupname 4.0K 2010-07-26 12:31 phpMyAdmin-3.3.5-english

However, when I type ls -lha phpMyAdmin-3.3.5, I get a listing of the contents of the directory. How do I type the command so that I see only

drwxrwxr-x 11 username groupname 4.0K 2010-07-26 12:31 phpMyAdmin-3.3.5-english

? I want to do this with symlinked directories, so I can see where they're linked to, not their contents.

1 Answer 1

16
ls -lhad phpMyAdmin-3.3.5-english

The -d flag is used to tell ls that you want to show the properties of the given directory, not its contents.

8
  • 1
    This is basic stuff. Reading the manpage of the ls command is always a good idea.
    – Alex Bitek
    Commented Aug 18, 2010 at 15:46
  • 1
    So many man pages, so many switches. Sometimes the mind just glosses.
    – user394
    Commented Aug 18, 2010 at 16:12
  • 2
    Unix koan: How many lowercase letters are invalid switches to ls ?
    – pjz
    Commented Aug 18, 2010 at 21:52
  • 2
    @user394: "is there a way to search in them?" Yes. Press /, then enter a search term, then press return and man will jump to the first occurrence of the term in the manpage. You can then press / and return without a search term in between to jump to the next occurrence.
    – sepp2k
    Commented Aug 19, 2010 at 16:51
  • 1
    @sepp2k Of course, that behaviour is pager-specific. In most, you can also press n to go to the next occurrence.
    – Chris Down
    Commented Feb 9, 2012 at 16:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .