Re: Finding Hard Links??
Posted in 1998
rbruenin@my-dejanews.com wrote: > > Thanks for reviewing my question. I am running on-line on Dec Alpha with > unix v4.0. I need a way to programatically via shell script to identify the > existing hard links on the system. Ls only shows the soft links and my > limited understanding of the raw devices is that they are created by > establishing a hard link to a disk partition.. So aside from some paper > documentation and existing DB spaces currently used by informix I am looking > for a way via unix that I can identify all the existing hard links. Sorry ALL UNIX directory entries are in fact hard links to the file's inode. That is why even when you create a file yourself which has no other links than its original directory entry an ls -l will show the number of links = 1. You could run ls -l and awk for a link count (field $3) > 1. It is true that all devices representing disk partitions or drives will have at least two device driver files pointing to them, a raw and a cooked device in /dev/dsk and /dev/rdsk usually, these are not linked to the same inode, they do however have the same major and minor device numbers. You can therefore recognize device drivers because on ls -li they show a major,minor device number pair rather than an inode number. However so do pseudo-terminal, serial, tape, and other device files. What is it you are trying to accomplish? Give us more detail and we can try to help. Art S. Kagel