13

Possible Duplicate:
What is the number between file permission and owner in ls -l command output?

I've been using Linux for years now and I'm embarrassed to say that until now I didn't notice that I have no idea what the second column of ls -l means:

-r--r--r-- 1 roic develop1 roic  685 2012-10-11 14:15 API.h
           ^

In this example - 1. What does it stand for?

0
9

It is the no. of the links that the file is having...links is the nothing but different names of the same file

Links are of two type hard and soft links

use the following code:

    ln file1 file2 #ln command creates file2 as a link of file 1
    ls -l file1

This will show 2 in place of 1 bcoz file1 has two names Now file1 and file2 Now same file can be used by two different names

Arun

3
  • 4
    As manatwork's linked answer points out, it is the number of hard links only. Soft links don't affect this refcount.
    – Useless
    Nov 6 '12 at 11:38
  • But make sure that file2 is not already created while using the above code..thnx Nov 6 '12 at 11:39
  • ya you are ryt....soft link doesnt affect refcount. @useless Nov 6 '12 at 11:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.