coreutils: What information is listed
1
1 10.1.2 What information is listed
1 ---------------------------------
1
1 These options affect the information that ‘ls’ displays. By default,
1 only file names are shown.
1
1 ‘--author’
1 List each file’s author when producing long format directory
1 listings. In GNU/Hurd, file authors can differ from their owners,
1 but in other operating systems the two are the same.
1
1 ‘-D’
1 ‘--dired’
1 With the long listing (‘-l’) format, print an additional line after
1 the main output:
1
1 //DIRED// BEG1 END1 BEG2 END2 ...
1
1 The BEGN and ENDN are unsigned integers that record the byte
1 position of the beginning and end of each file name in the output.
1 This makes it easy for Emacs to find the names, even when they
1 contain unusual characters such as space or newline, without fancy
1 searching.
1
1 If directories are being listed recursively (‘-R’), output a
1 similar line with offsets for each subdirectory name:
1
1 //SUBDIRED// BEG1 END1 ...
1
1 Finally, output a line of the form:
1
1 //DIRED-OPTIONS// --quoting-style=WORD
1
11 where WORD is the quoting style (⇒Formatting the file
names).
1
1 Here is an actual example:
1
1 $ mkdir -p a/sub/deeper a/sub2
1 $ touch a/f1 a/f2
1 $ touch a/sub/deeper/file
1 $ ls -gloRF --dired a
1 a:
1 total 8
1 -rw-r--r-- 1 0 Jun 10 12:27 f1
1 -rw-r--r-- 1 0 Jun 10 12:27 f2
1 drwxr-xr-x 3 4096 Jun 10 12:27 sub/
1 drwxr-xr-x 2 4096 Jun 10 12:27 sub2/
1
1 a/sub:
1 total 4
1 drwxr-xr-x 2 4096 Jun 10 12:27 deeper/
1
1 a/sub/deeper:
1 total 0
1 -rw-r--r-- 1 0 Jun 10 12:27 file
1
1 a/sub2:
1 total 0
1 //DIRED// 48 50 84 86 120 123 158 162 217 223 282 286
1 //SUBDIRED// 2 3 167 172 228 240 290 296
1 //DIRED-OPTIONS// --quoting-style=literal
1
1 Note that the pairs of offsets on the ‘//DIRED//’ line above
1 delimit these names: ‘f1’, ‘f2’, ‘sub’, ‘sub2’, ‘deeper’, ‘file’.
1 The offsets on the ‘//SUBDIRED//’ line delimit the following
1 directory names: ‘a’, ‘a/sub’, ‘a/sub/deeper’, ‘a/sub2’.
1
1 Here is an example of how to extract the fifth entry name,
1 ‘deeper’, corresponding to the pair of offsets, 222 and 228:
1
1 $ ls -gloRF --dired a > out
1 $ dd bs=1 skip=222 count=6 < out 2>/dev/null; echo
1 deeper
1
1 Note that although the listing above includes a trailing slash for
1 the ‘deeper’ entry, the offsets select the name without the
1 trailing slash. However, if you invoke ‘ls’ with ‘--dired’ along
1 with an option like ‘--escape’ (aka ‘-b’) and operate on a file
1 whose name contains special characters, notice that the backslash
1 _is_ included:
1
1 $ touch 'a b'
1 $ ls -blog --dired 'a b'
1 -rw-r--r-- 1 0 Jun 10 12:28 a\ b
1 //DIRED// 30 34
1 //DIRED-OPTIONS// --quoting-style=escape
1
1 If you use a quoting style that adds quote marks (e.g.,
1 ‘--quoting-style=c’), then the offsets include the quote marks. So
1 beware that the user may select the quoting style via the
1 environment variable ‘QUOTING_STYLE’. Hence, applications using
1 ‘--dired’ should either specify an explicit
1 ‘--quoting-style=literal’ option (aka ‘-N’ or ‘--literal’) on the
1 command line, or else be prepared to parse the escaped names.
1
1 ‘--full-time’
1 Produce long format directory listings, and list times in full. It
1 is equivalent to using ‘--format=long’ with ‘--time-style=full-iso’
1 (⇒Formatting file timestamps).
1
1 ‘-g’
1 Produce long format directory listings, but don’t display owner
1 information.
1
1 ‘-G’
1 ‘--no-group’
1 Inhibit display of group information in a long format directory
1 listing. (This is the default in some non-GNU versions of ‘ls’, so
1 we provide this option for compatibility.)
1
1 ‘-h’
1 ‘--human-readable’
1 Append a size letter to each size, such as ‘M’ for mebibytes.
1 Powers of 1024 are used, not 1000; ‘M’ stands for 1,048,576 bytes.
1 This option is equivalent to ‘--block-size=human-readable’. Use
1 the ‘--si’ option if you prefer powers of 1000.
1
1 ‘-i’
1 ‘--inode’
1 Print the inode number (also called the file serial number and
1 index number) of each file to the left of the file name. (This
1 number uniquely identifies each file within a particular file
1 system.)
1
1 ‘-l’
1 ‘--format=long’
1 ‘--format=verbose’
1 In addition to the name of each file, print the file type, file
1 mode bits, number of hard links, owner name, group name, size, and
1 timestamp (⇒Formatting file timestamps), normally the
1 modification timestamp (the mtime, ⇒File timestamps). Print
1 question marks for information that cannot be determined.
1
1 Normally the size is printed as a byte count without punctuation,
1 but this can be overridden (⇒Block size). For example, ‘-h’
1 prints an abbreviated, human-readable count, and
1 ‘--block-size="'1"’ prints a byte count with the thousands
1 separator of the current locale.
1
1 For each directory that is listed, preface the files with a line
1 ‘total BLOCKS’, where BLOCKS is the total disk allocation for all
1 files in that directory. The block size currently defaults to 1024
1 bytes, but this can be overridden (⇒Block size). The BLOCKS
1 computed counts each hard link separately; this is arguably a
1 deficiency.
1
1 The file type is one of the following characters:
1
1 ‘-’
1 regular file
1 ‘b’
1 block special file
1 ‘c’
1 character special file
1 ‘C’
1 high performance (“contiguous data”) file
1 ‘d’
1 directory
1 ‘D’
1 door (Solaris 2.5 and up)
1 ‘l’
1 symbolic link
1 ‘M’
1 off-line (“migrated”) file (Cray DMF)
1 ‘n’
1 network special file (HP-UX)
1 ‘p’
1 FIFO (named pipe)
1 ‘P’
1 port (Solaris 10 and up)
1 ‘s’
1 socket
1 ‘?’
1 some other file type
1
1 The file mode bits listed are similar to symbolic mode
1 specifications (⇒Symbolic Modes). But ‘ls’ combines
1 multiple bits into the third character of each set of permissions
1 as follows:
1
1 ‘s’
1 If the set-user-ID or set-group-ID bit and the corresponding
1 executable bit are both set.
1
1 ‘S’
1 If the set-user-ID or set-group-ID bit is set but the
1 corresponding executable bit is not set.
1
1 ‘t’
1 If the restricted deletion flag or sticky bit, and the
1 other-executable bit, are both set. The restricted deletion
11 flag is another name for the sticky bit. ⇒Mode
Structure.
1
1 ‘T’
1 If the restricted deletion flag or sticky bit is set but the
1 other-executable bit is not set.
1
1 ‘x’
1 If the executable bit is set and none of the above apply.
1
1 ‘-’
1 Otherwise.
1
1 Following the file mode bits is a single character that specifies
1 whether an alternate access method such as an access control list
1 applies to the file. When the character following the file mode
1 bits is a space, there is no alternate access method. When it is a
1 printing character, then there is such a method.
1
1 GNU ‘ls’ uses a ‘.’ character to indicate a file with a security
1 context, but no other alternate access method.
1
1 A file with any other combination of alternate access methods is
1 marked with a ‘+’ character.
1
1 ‘-n’
1 ‘--numeric-uid-gid’
1 Produce long format directory listings, but display numeric user
1 and group IDs instead of the owner and group names.
1
1 ‘-o’
1 Produce long format directory listings, but don’t display group
1 information. It is equivalent to using ‘--format=long’ with
1 ‘--no-group’ .
1
1 ‘-s’
1 ‘--size’
1 Print the disk allocation of each file to the left of the file
1 name. This is the amount of disk space used by the file, which is
1 usually a bit more than the file’s size, but it can be less if the
1 file has holes.
1
1 Normally the disk allocation is printed in units of 1024 bytes, but
1 this can be overridden (⇒Block size).
1
1 For files that are NFS-mounted from an HP-UX system to a BSD
1 system, this option reports sizes that are half the correct values.
1 On HP-UX systems, it reports sizes that are twice the correct
1 values for files that are NFS-mounted from BSD systems. This is
1 due to a flaw in HP-UX; it also affects the HP-UX ‘ls’ program.
1
1 ‘--si’
1 Append an SI-style abbreviation to each size, such as ‘M’ for
1 megabytes. Powers of 1000 are used, not 1024; ‘M’ stands for
1 1,000,000 bytes. This option is equivalent to ‘--block-size=si’.
1 Use the ‘-h’ or ‘--human-readable’ option if you prefer powers of
1 1024.
1
1 ‘-Z’
1 ‘--context’
1 Display the SELinux security context or ‘?’ if none is found. When
1 used with the ‘-l’ option, print the security context to the left
1 of the size column.
1