9

I want to list every file, including hidden files, in the current directory. I don't want to include the parent (..) and current (.) directory.

I found this:

how to glob every hidden file except current and parent directory

At the end, someone states ls -A is the way to go, but it's downvoted. However, it seems to work. What's wrong with ls -A?

4
  • 1
    Is this discussion or (real) question?
    – Pandya
    Oct 25, 2014 at 12:55
  • ls -A is the correct answer to your question, but not to the question you linked to (that question was about listing only hidden files and directories).
    – angus
    Oct 25, 2014 at 12:57
  • I want to know if this is supported everywhere or if there is a better way of doing what I want to achieve.
    – Smile4ever
    Oct 25, 2014 at 12:57
  • 1
    in fact, as of the latest version of the POSIX-spec, ls -A is an officially specified option.
    – mikeserv
    Oct 25, 2014 at 15:16

1 Answer 1

21

ls -A is the correct answer to your question, but not to the question you linked to (that question was about listing only hidden files and directories).

1
  • 1
    More precise is that question is about globbing, hidden files and directories with the exclusion of . and .., not about listing. Listing only those globbed entries is not the same as doing ls -A, but this should be close enough for the OP.
    – Anthon
    Oct 25, 2014 at 13:03

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.