manpagez: man pages & more
info coreutils
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.1.1 Which files are listed

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 ‘.’.

-a
--all

In directories, do not ignore file names that start with ‘.’.

-A
--almost-all

In directories, do not ignore all file names that start with ‘.’; ignore only ‘.’ and ‘..’. The ‘--all’ (‘-a’) option overrides this option.

-B
--ignore-backups

In directories, ignore files that end with ‘~’. This option is equivalent to ‘--ignore='*~' --ignore='.*~'’.

-d
--directory

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.

-H
--dereference-command-line

If a command line argument specifies a symbolic link, show information for the file the link references rather than for the link itself.

--dereference-command-line-symlink-to-dir

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 when no other dereferencing-related option has been specified (‘--classify’ (‘-F’), ‘--directory’ (‘-d’), (‘-l’), ‘--dereference’ (‘-L’), or ‘--dereference-command-line’ (‘-H’)).

--group-directories-first

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.

--hide=PATTERN

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.

-I pattern
--ignore=pattern

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 ‘#’.

-L
--dereference

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.

-R
--recursive

List the contents of all directories recursively.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2017
Individual documents may contain additional copyright information.