ls long listing format各个字段的含义

Posted by 4Aiur on 04/06/2010 in Linux |

ls long listing format各个字段的含义

ls -l
total 8
-rw-r--r-- 1 root root    2 Jul 27 13:30 bar
-rw-rw-r-- 1 root root 7056 Jul 27 13:27 foo

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.

From the output above we can deduct a following information:

  • -rw-rw-r- permissions
  • 1 : number of linked hard-links
  • root: owner of the file
  • root: to which group this file belongs to
  • 7056: file size
  • Jul 27 13:27 modification date and time
  • foo: file/directory name

To answer your question we will look more closely at the permissions part of ls long listing format output:


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.


Copyright © 2010-2024 4Aiur All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from