10
drwxr-xr-x. 2 root root 4096 Jun 29 16:44 db
drwxr-xr-x. 2 root root 4096 Jun 29 16:44 djproject
-rwxr-xr-x. 1 root root   38 Jun 29 16:44 index.html
drwxr-xr-x. 2 root root 4096 Jun 29 16:44 jobs
-rwxr-xr-x. 1 root root  252 Jun 29 16:44 manage.py
drwxr-xr-x. 3 root root 4096 Jun 29 16:44 templates

What is the meaning of those numbers in the second column? Do they have some relation to file and folder permissions? How do I change the numbers?

6
  • 5
    You can just man ls
    – VanDarg
    Commented Jul 2, 2012 at 1:36
  • 4
    Please accept some of the answers to your previous questions. You can do this by clicking the check mark next to the answer that you feel best answered the question.
    – bdonlan
    Commented Jul 2, 2012 at 1:37
  • 2
    info ls gives the information you need, man ls just points you to the info page.
    – tpg2114
    Commented Jul 2, 2012 at 1:37
  • 2
    @tpg2114 Your first comment is accurate but, on at least one machine I can connect to your second is completely wrong.
    – mlp
    Commented Mar 11, 2019 at 15:29
  • See also What do the fields in ls -l output mean? (on U&L). Commented Mar 11, 2019 at 15:34

4 Answers 4

25

That's the number of hard links to the file or directory. For files, this will usually be 1, unless you've created additional hard links to it with ln.

For directories, it's 2 + the number of subdirectories. This is because a directory can be referred to either by its name in the parent directory, . in itself, or .. in each subdirectory.

0
2

This indicates the number of hard links. This article explain the output of the ls -l command in more detail.

2
  • 1
    The article link is broken...
    – Rick
    Commented Mar 6, 2018 at 12:32
  • @Rick Thanks for the heads-up, I just linked an alternative site to this.
    – Levon
    Commented Mar 6, 2018 at 15:43
0

The numbers in the second column is effectively the number of "links" to the file or directory. It is similar to the concept of reference count in oop.

0
0
drwxr-xr-x 2 matt db 4096 Jan 30 23:08 documents

-rw-r--r-- 1 matt db   49 Jan 31 01:17 sum.pl

The first character indicates the type of the file. - for normal file, d for directory, l for link file and s for socket file

The next 9 characters in the first field represent the permissions. Each 3 characters refers the read (r), write (w), execute (x) permissions on owner, group and others. - means no permission.

The second field indicates the number of links to that file.

The third field indicates the owner name.

The fourth field indicates the group name.

The fifth field represents the file size in bytes.

The sixth field represents the last modification date and time of the file.

And finally the seventh field is the name of the file.

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