When I run:
ls -n
I get something like:
-rwxrwxrwx 1 1000 1000 765528 2009-10-15 18:41 file1 drwxr-xr-x 10 1000 1000 4096 2010-12-07 20:50 dir1 drwxr-xr-x 3 1000 1000 4096 2010-10-24 16:57 dir2
What does the second column (the number) mean?
When I run:
ls -n
I get something like:
-rwxrwxrwx 1 1000 1000 765528 2009-10-15 18:41 file1 drwxr-xr-x 10 1000 1000 4096 2010-12-07 20:50 dir1 drwxr-xr-x 3 1000 1000 4096 2010-10-24 16:57 dir2
What does the second column (the number) mean?
The second column is the number of hard links to the file. For a directory, the number of hard links is the number of immediate subdirectories it has plus its parent directory and itself.
Linux Gazette Issue 35
Linux Gazette Issue 93
First Column:
drwxr-xr-x
Second Column:
2
Third nd Fourth Column:
1000
1000
Fifth column:
4096
Sixth column:
2010-12-02 15:56
Seventh column:
Books
NOTE:
For more information look at this link.
The answers given regarding directories will give the right number, but for the wrong reasons. The number is not a count of the subdirectories plus "." and ".."
The number is actually the same as for a file: the number of hard links to the directory. For example, let us create a new directory:
You can see that the number of links is 2. These links are the name "temp" and the "." directory within temp (aka "temp/.") Not the ".." directory. That is a link to the parent of "temp". Which kind of explains why creating a sub-directory creates a new link. Let's do it:
There are now 3 links to the directory. They are "temp", "temp/." and "subtemp/.." (that is, the ".." directory within "subtemp"). So that's why subdirectories add a link - because they all have a ".." directory referring to the parent.
This field specifies the number of links or directories inside this directory.
For example:
You can see the number of links or directories in the Desktop is 6. Let us check it.
Here you can see the links and directories inside the desktop are :
'.' # the parent directory
'..' # current directory or present working directory.
'Bugs'
'plugin'
'plugins'
'saml'
so total 6. Hope this helps.
check this link for more info. http://www.go2linux.org/command-ls-file-permissions
This gives the number of links/directories immediately inside this file/directory. For files this number should be 1 and for directories it should be number of directories+2 i.e for . and .. directories