nondoo nondoo - 1 year ago 199
Linux Question

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

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 Source

Read ls(1) documentation. At least, take the habit of trying

ls --help

You'll get something starting with:

Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all                  do not ignore entries starting with .
  -A, --almost-all           do not list implied . and ..
      --author               with -l, print the author of each file
  -b, --escape               print C-style escapes for nongraphic characters


You want

ls -A
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download