Command to list all files except . (dot) and .. (dot dot)

nondoo picture nondoo · Mar 14, 2014 · Viewed 18.2k times · Source

I'm trying to find a command that would list all files (including hidden files), but must exclude the current directory and parent directory. Please help.

$ ls -a \.\..

Answer

Basile Starynkevitch picture Basile Starynkevitch · Mar 14, 2014

Regarding the ls(1) documentation (man ls):

-A, --almost-all do not list implied . and ..

you need (without any additional argument such as .*):

ls -A

or better yet:

/bin/ls -A