From owner-freebsd-questions Mon May 12 04:07:48 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id EAA12619 for questions-outgoing; Mon, 12 May 1997 04:07:48 -0700 (PDT) Received: from mail.EUnet.hu (www.eunet.hu [193.225.28.100]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id EAA12608 for ; Mon, 12 May 1997 04:07:43 -0700 (PDT) Received: by mail.EUnet.hu, id NAA03004; Mon, 12 May 1997 13:07:36 +0200 Received: (from zgabor@localhost) by CoDe.hu (8.7.5/8.7.3) id KAA00677; Mon, 12 May 1997 10:38:54 +0200 (MET DST) From: Zahemszky Gabor Message-Id: <199705120838.KAA00677@CoDe.hu> Subject: Re: hard links To: freebsd-questions@freebsd.org (FreeBSD questions) Date: Mon, 12 May 1997 10:38:54 +0200 (MET DST) Cc: un_x@anchorage.net In-Reply-To: from Steve Howe at "May 11, 97 12:09:48 pm" X-Mailer: ELM [version 2.4ME+ PL11 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > is there any way to determine what files are > hard links to s specific file? it's obvious > for softlinks using "ls", but what about > hard links? ls -i one_hard_link df one_hard_link -> get the last column: Mounted on (eg: /var) find /var -xdev -inum inum_of_one_hard_link_from_ls -print (or on any 4.4BSD-derived system?) find -x /var -inum ... And of course, from the ls -l list, the number after the permissions is the number of hard links of this file. Bye, Gabor -- #!/bin/ksh Z='21N16I25C25E30, 40M30E33E25T15U!' ;IFS=' ABCDEFGHIJKLMNOPQRSTUVWXYZ ';set $Z;for i { [[ $i = ? ]]&&print $i&&break;[[ $i = ??? ]]&&j=$i&&i=${i%?};typeset -i40 i=8#$i;print -n ${i#???};[[ "$j" = ??? ]]&&print -n "${j#??} "&&j=;typeset +i i;};IFS=' 0123456789 ';set $Z;X=;for i { [[ $i = , ]]&&i=2;[[ $i = ?? ]]||typeset -l i;X="$X $i";typeset +l i;};print "$X"