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

4 Answers

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

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

2

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
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.