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?

Smile4ever
  • 193
  • 1
  • 1
  • 6
  • 1
    Is this discussion or (real) question? – Pandya Oct 25 '14 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 '14 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 '14 at 12:57
  • 1
    in fact, as of the latest version of the [POSIX-spec](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html), `ls -A` is an officially specified option. – mikeserv Oct 25 '14 at 15:16

1 Answers1

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

angus
  • 12,131
  • 3
  • 44
  • 40
  • 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 '14 at 13:03