13

What do the following numbers represent?

4
  • 3
    they are file permissions and properties. perhaps you should have a good readin here wiki.archlinux.org/index.php/File_permissions_and_attributes
    – ostendali
    Dec 18, 2015 at 14:32
  • 2
    How many time did you read man ls?
    – Ken Sharp
    Dec 18, 2015 at 22:28
  • @KenSharp The copy of the ls manpage on linux.die.net doesn't actually give all the relevant information. For example, it doesn't state what the timestamp is that's shown, and GNU coreutils documentation says only that it is "normally the modification timestamp".
    – AJM
    Aug 17, 2022 at 13:20
  • Though I admit I don't know of any situation in which it's been, say, another timestamp like the status change or creation date.
    – AJM
    Aug 17, 2022 at 13:20

2 Answers 2

20

Let’s take this one to analyse:

-rwxrw-r-- 1 root    root       4096 Dec 18 16:41 somefile.txt

We will split the output for better understanding.

Field1  Field2  Field3  Field4  Field5  Field6  Field7  Field8  Field9        Field10

-       rwx     rw-     r--     1       root    root    4096    Dec 18 16:41  somefile.txt
  • First field:

    • - for regular file, d for Directory, l for symlink
  • Second: The owner can read, write and execute this file

  • Third: The owner's group can read and write this file

  • Fourth: Other users can read, but not write or execute this file.

  • Fifth: The number of hard links to this file or directories inside this directory.

  • Sixth: The object's owner

  • Seventh: The object's owner's group. All of the users in this group (for example, root, user, www-data, etc.) are affected by the permissions in field 3.

  • Eighth field is the object's size in bytes. Note: ls -lh will use k, M, G, T etc. for human readable. (See man ls or run ls --help.)

  • Ninth field: The object's last modified time; for directories this is not inheritive.

  • Tenth field: The object's name as stored in the filesystem's table of contents

See understanding the Unix permission model, man chmod and apropos permissions for more information.

Note: Some versions of ls(1) also display the octal permissions, which are a simple way of using a number to display and store the first through fourth fields.

4
  • 3
    The first field could also be b for a block device special file, c for a character device special file, s for a socket, or p for a fifo special file (aka named pipe). You are also missing a field in between the fourth and fifth, where a single character may be appended to the permissions string, indicating Extended Attributes (@) or Extended Security Information such as Access Control Lists (+). The third character in field 2/3 can also be s or S, the third character in field 4 can also be t or T. Dec 18, 2015 at 17:53
  • @JörgWMittag right you are. you can edit that in, if you like
    – cat
    Dec 18, 2015 at 18:44
  • 3
    field5 = the number of hard links to this file. symlinks to a file don't add 1 to this file's 5th field. Try : touch foo bar and then ls -l foo bar (both will have 1 inode pointing them). then ln foo baz ; ls -l foo bar baz will show both foo and baz, 2 entries pointing to the same inode (pointing to the content of foo), both have "2" as their hard link number. Then add a symlink: ln -s foo toto and still only foo & baz have 2 inodes pointing the same file, toto has 1. In the end, foo & baz will have 2, and bar & toto will have 1 in their 5th field, as both have no hardlinks to them Dec 18, 2015 at 19:13
  • Script to calculate permissions: github.com/crushedice2000/ext4-imc
    – 0x2b3bfa0
    Dec 18, 2015 at 19:58
4

The numbers represents:

1 is the number of hard links

7160 the file size in bytes.

Not the answer you're looking for? Browse other questions tagged .