View previous topic :: View next topic |
Author |
Message |
IQgryn l33t
Joined: 05 Sep 2005 Posts: 764 Location: WI, USA
|
Posted: Thu Dec 06, 2007 9:18 am Post subject: Directory ls/stat oddness (ext3 and reiserfs, at least) |
|
|
I just noticed something odd: the "number of (hard)links" field in ls -l shows most of the directories on my system as having multiple links.. Just to be sure, I used stat to check, with the same results.
Code: | iqgryn ~ # ls -ld /
drwxr-xr-x 20 root root 4096 Sep 29 02:46 /
iqgryn ~ # stat /
File: `/'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 80ah/2058d Inode: 2 Links: 20
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2007-09-12 12:58:38.000000000 -0500
Modify: 2007-09-29 02:46:03.000000000 -0500
Change: 2007-09-29 02:46:03.000000000 -0500 |
(notice the 20 in each output)
Anyone know what this means? |
|
Back to top |
|
|
BradN Advocate
Joined: 19 Apr 2002 Posts: 2391 Location: Wisconsin (USA)
|
Posted: Thu Dec 06, 2007 8:30 pm Post subject: |
|
|
Probably what you're seeing is an extra link from the . directory entry and all the .. directories contained in the subdirectories. My system has 22 links listed for /, although this seems high by about 4 for the number of links I can count by hand. |
|
Back to top |
|
|
x22 Apprentice
Joined: 24 Apr 2006 Posts: 208
|
Posted: Fri Dec 07, 2007 12:32 pm Post subject: |
|
|
Number of links for a directory is usually (or always?) the number of subdirectories plus two. |
|
Back to top |
|
|
|