These options determine which files ls
lists information for.
By default, ls
lists files and the contents of any
directories on the command line, except that in directories it ignores
files whose names start with ‘.’.
In directories, do not ignore file names that start with ‘.’.
In directories, do not ignore all file names that start with ‘.’; ignore only . and ... The --all (-a) option overrides this option.
In directories, ignore files that end with ‘~’. This option is equivalent to ‘--ignore='*~' --ignore='.*~'’.
List just the names of directories, as with other types of files, rather than listing their contents. Do not follow symbolic links listed on the command line unless the --dereference-command-line (-H), --dereference (-L), or --dereference-command-line-symlink-to-dir options are specified.
If a command line argument specifies a symbolic link, show information for the file the link references rather than for the link itself.
Do not dereference symbolic links, with one exception: if a command line argument specifies a symbolic link that refers to a directory, show information for that directory rather than for the link itself. This is the default behavior unless long format is being used or any of the following options is in effect: --classify (-F), --directory (-d), --dereference (-L), or --dereference-command-line (-H)).
Group all the directories before the files and then sort the directories and the files separately using the selected sort key (see --sort option). That is, this option specifies a primary sort key, and the --sort option specifies a secondary key. However, any use of --sort=none (-U) disables this option altogether.
In directories, ignore files whose names match the shell pattern pattern, unless the --all (-a) or --almost-all (-A) is also given. This option acts like --ignore=pattern except that it has no effect if --all (-a) or --almost-all (-A) is also given.
This option can be useful in shell aliases. For example, if
lx
is an alias for ‘ls --hide='*~'’ and ly
is
an alias for ‘ls --ignore='*~'’, then the command ‘lx -A’
lists the file README~ even though ‘ly -A’ would not.
In directories, ignore files whose names match the shell pattern (not regular expression) pattern. As in the shell, an initial ‘.’ in a file name does not match a wildcard at the start of pattern. Sometimes it is useful to give this option several times. For example,
$ ls --ignore='.??*' --ignore='.[^.]' --ignore='#*'
The first option ignores names of length 3 or more that start with ‘.’, the second ignores all two-character names that start with ‘.’ except ‘..’, and the third ignores names that start with ‘#’.
When showing file information for a symbolic link, show information
for the file the link references rather than the link itself.
However, even with this option, ls
still prints the name
of the link itself, not the name of the file that the link points to.
List the contents of all directories recursively.