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