[plug] Identifying harded files

James Devenish devenish at guild.uwa.edu.au
Thu May 8 14:58:02 WST 2003


In message <1052371237.975.25.camel at vaio>
on Thu, May 08, 2003 at 01:20:37PM +0800, Ryan wrote:
> Now hard linked files - 'ls -li' will show it as:
> 
> 618955 -rwxrwxrwx    1 ryan    ryan     953704 Apr  2 07:40 file1
> 618955 -rwxrwxrwx    1 ryan    ryan     953704 Apr  2 07:40 file2

Erm...have you tried `ls -l`? :)
It shows you the link count right after the permissions flags! The GNU
ls man/info pages don't seem to mention this, which is odd since most
operatings systems do make mention of it.  Might want to file a bug
report / feature suggestion / patch.

I ran `touch file1 && ln file1 file2 && ln -s file1 file3 && ls -l file*`
on a few machines:

OpenBSD:

-rw-r-----  2 devenish  staff  0 May  8 14:53 file1
-rw-r-----  2 devenish  staff  0 May  8 14:53 file2
lrwxr-xr-x  1 devenish  staff  5 May  8 14:53 file3@ -> file1

Solaris:

-rw-r-----   2 devenish staff        0 May  8 14:54 file1
-rw-r-----   2 devenish staff        0 May  8 14:54 file2
lrwxrwxrwx   1 devenish staff        5 May  8 14:54 file3 -> file1

Linux:

-rw-r-----    2 devenish devenish        0 May  8 14:54 file1
-rw-r-----    2 devenish devenish        0 May  8 14:54 file2
lrwxrwxrwx    1 devenish devenish        5 May  8 14:54 file3 -> file1

Same on Tru64, Mac OS X, etc. (Guess it's POSIX.)





More information about the plug mailing list