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.

15
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.

  • 1
    This is basic stuff. Reading the manpage of the ls command is always a good idea. – bitek Aug 18 '10 at 15:46
  • So many man pages, so many switches. Sometimes the mind just glosses. – user394 Aug 18 '10 at 16:12
  • 1
    Unix koan: How many lowercase letters are invalid switches to ls ? – pjz Aug 18 '10 at 21:52
  • 1
    @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 Aug 19 '10 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 Feb 9 '12 at 16:21

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.