mkhaw@vaxc.UUCP (05/20/87)
What does the "link count" shown by "ls -ld" mean for a directory?
Is it the same for SysV and 4bsd?
Mike Khaw
--
internet: mkhaw@teknowledge-vaxc.arpa
usenet: {hplabs|sun|ucbvax|decwrl|sri-unix}!mkhaw%teknowledge-vaxc.arpa
USnail: Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303pdb@sei.cmu.edu.UUCP (05/20/87)
In article <12913@vaxc.ARPA> mkhaw@vaxc.ARPA (Michael Khaw) writes: >What does the "link count" shown by "ls -ld" mean for a directory? >Is it the same for SysV and 4bsd? At least on 4bsd, the link count for a directory is exactly that. Even though users can't link directories, mkdir(2) does it all the time. The special entries '.' and '..' in a directory are links to itself, and it's parent, respectively. If a directory has many subdirectories, it is possible for it's link count to be very large. --Pat.
arosen@ulowell.cs.ulowell.edu (Andy Rosen) (05/20/87)
In article <12913@vaxc.ARPA> mkhaw@vaxc.ARPA (Michael Khaw) writes: >What does the "link count" shown by "ls -ld" mean for a directory? >Is it the same for SysV and 4bsd? It's just like for a file. It'll always (hopefully) be at least two. One for the directory itself, and one for ".". It's increased by one every time a sub-directory is added in it (for ".."). For what it's worth, you can tell how many sub-directories a directory has even if you can't look at the directory by looking at the link count. It's the same for SysV and BSD. -- Andy Rosen | ulowell!arosen | ************* | "I got this guitar and I ULowell, Box #3031 | | * RD in '88 * | learned how to make it Lowell, Ma 01854 | | ************* | talk" -Thunder Road
merlin@hqda-ai.UUCP (David S. Hayes) (05/21/87)
The link count for a directory has the same meaning as the
link count for a file. It indicates how many names there are for
the directory.
Every directory has at least two different names:
from above: parent/directory
from 'directory': .
If there are subdirectories, each of them adds another link:
from below: subdir/..
It is even possible to create additional links to directories:
ln directory link
This option is restricted to root, and requires the -f (force)
switch to prevent accidental use.
--
David S. Hayes, The Merlin of Avalon PhoneNet: (202) 694-6900
UUCP: *!seismo!sundc!hqda-ai!merlin ARPA: merlin%hqda-ai@seismo.css.gov