LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Documentation Explaining the Output of ls Command (https://www.linuxquestions.org/questions/linux-newbie-8/documentation-explaining-the-output-of-ls-command-645847/)

lostjohnny 05-30-2008 09:56 AM

Documentation Explaining the Output of ls Command
 
Sorry for the very basic question, but I didn't find anything in either man or info that explains the exact meaning of the output of ls, particularly ls -l.

Can someone tell me please where this documentation is to be found?

TIA,

Lost Johnny

i92guboj 05-30-2008 10:01 AM

Quote:

Originally Posted by lostjohnny (Post 3169384)
Sorry for the very basic question, but I didn't find anything in either man or info that explains the exact meaning of the output of ls, particularly ls -l.

Can someone tell me please where this documentation is to be found?

TIA,

Lost Johnny

Try "info ls" instad of "man ls". The info page is much more complete. ;)

stefan_nicolau 05-30-2008 10:11 AM

Here's what the info page says

Code:

`-l'
`--format=long'
`--format=verbose'
    In addition to the name of each file, print the file type, file
    mode bits, number of hard links, owner name, group name, size, and
    timestamp (*Note Formatting file timestamps::), normally the
    modification time.  Print question marks for information that
    cannot be determined.

    Normally the size is printed as a byte count without punctuation,
    but this can be overridden (*Note Block size::).  For example, `-h'
    prints an abbreviated, human-readable count, and
    `--block-size="'1"' prints a byte count with the thousands
    separator of the current locale.

    For each directory that is listed, preface the files with a line
    `total BLOCKS', where BLOCKS is the total disk allocation for all
    files in that directory.  The block size currently defaults to 1024
    bytes, but this can be overridden (*Note Block size::).  The
    BLOCKS computed counts each hard link separately; this is arguably
    a deficiency.

    The file type is one of the following characters:

    `-'
          regular file

    `b'
          block special file

    `c'
          character special file

    `C'
          high performance ("contiguous data") file

    `d'
          directory

    `D'
          door (Solaris 2.5 and up)

    `l'
          symbolic link

    `M'
          off-line ("migrated") file (Cray DMF)

    `n'
          network special file (HP-UX)

    `p'
          FIFO (named pipe)

    `P'
          port (Solaris 10 and up)

    `s'
          socket

    `?'
          some other file type

    The file mode bits listed are similar to symbolic mode
    specifications (*Note Symbolic Modes::).  But `ls' combines
    multiple bits into the third character of each set of permissions
    as follows:

    `s'
          If the set-user-ID or set-group-ID bit and the corresponding
          executable bit are both set.

    `S'
          If the set-user-ID or set-group-ID bit is set but the
          corresponding executable bit is not set.

    `t'
          If the restricted deletion flag or sticky bit, and the
          other-executable bit, are both set.  The restricted deletion
          flag is another name for the sticky bit.  *Note Mode
          Structure::.

    `T'
          If the restricted deletion flag or sticky bit is set but the
          other-executable bit is not set.

    `x'
          If the executable bit is set and none of the above apply.

    `-'
          Otherwise.

    Following the file mode bits is a single character that specifies
    whether an alternate access method such as an access control list
    applies to the file.  When the character following the file mode
    bits is a space, there is no alternate access method.  When it is
    a printing character, then there is such a method.

    For a file with an extended access control list, a `+' character is
    listed.  Basic access control lists are equivalent to the
    permissions listed, and are not considered an alternate access
    method.


lostjohnny 05-30-2008 11:28 AM

Thanks guys.

Stefan, your reply gives me the information I was originally looking for. However, I was still unable to find this information for myself, because when I use "info ls" and go down to "* What information is listed::" on my system (Fedora Core 6), what it says for the '-l' option is different to what you have posted - it doesn't tell me about the file type characters (output below). Has the info file been improved since the version distributed with FC6?

Code:

`-l'
`--format=long'
`--format=verbose'
    In addition to the name of each file, print the file type,
    permissions, number of hard links, owner name, group name, size,
    and timestamp (*note Formatting file timestamps::), normally the
    modification time.

    Normally the size is printed as a byte count without punctuation,
    but this can be overridden (*note Block size::).  For example, `-h'
    prints an abbreviated, human-readable count, and
    `--block-size="'1"' prints a byte count with the thousands
    separator of the current locale.

    For each directory that is listed, preface the files with a line
    `total BLOCKS', where BLOCKS is the total disk allocation for all
    files in that directory.  The block size currently defaults to 1024
    bytes, but this can be overridden (*note Block size::).  The
    BLOCKS computed counts each hard link separately; this is arguably
    a deficiency.

    The permissions listed are similar to symbolic mode specifications
    (*note Symbolic Modes::).  But `ls' combines multiple bits into the
    third character of each set of permissions as follows:
    `s'
          If the setuid or setgid bit and the corresponding executable
          bit are both set.

    `S'
          If the setuid or setgid bit is set but the corresponding
          executable bit is not set.

    `t'
          If the sticky bit and the other-executable bit are both set.

    `T'
          If the sticky bit is set but the other-executable bit is not
          set.

    `x'
          If the executable bit is set and none of the above apply.

    `-'
          Otherwise.

    Following the permission bits is a single character that specifies
    whether an alternate access method applies to the file.  When that
    character is a space, there is no alternate access method.  When it
    is a printing character (e.g., `+'), then there is such a method.



All times are GMT -5. The time now is 08:31 PM.