From owner-freebsd-questions Fri Aug 2 20:24:47 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D6CBC37B401 for ; Fri, 2 Aug 2002 20:24:42 -0700 (PDT) Received: from hamberg.it.uu.se (hamberg.it.uu.se [130.238.9.198]) by mx1.FreeBSD.org (Postfix) with ESMTP id E6E5643E3B for ; Fri, 2 Aug 2002 20:24:41 -0700 (PDT) (envelope-from ertr1013@csd.uu.se) Received: (from ertr1013@localhost) by hamberg.it.uu.se (8.8.5/8.8.5) id FAA13186; Sat, 3 Aug 2002 05:24:34 +0200 (MET DST) Date: Sat, 3 Aug 2002 05:24:34 +0200 From: Erik Trulsson To: Adam Weinberger Cc: Steve Mazerski , freebsd-questions@FreeBSD.ORG Subject: Re: Re: Why hard, not soft links? Message-ID: <20020803052434.B2058@student.uu.se> References: <200208030344.27552.smazerski@yahoo.co.jp> <20020803014757.GC9210@vectors.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020803014757.GC9210@vectors.cx>; from adam@vectors.cx on Fri, Aug 02, 2002 at 06:47:57PM -0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Aug 02, 2002 at 06:47:57PM -0700, Adam Weinberger wrote: > if /usr/bin/nvi were a softlink to /usr/bin/vi, and you moved > /usr/bin/vi to /usr/bin/myeditor, then /usr/bin/nvi wouldn't point to > the correct place anymore, and would die. > > furthermore, a softlink implies "this is a shortcut to running this > command," whereas a hardlink implies "this is another name for this > command." > > FURTHERMORE, does $0 get set to the name of the calling softlink? Yes, actually it does. Another reason is that hardlinks are somewhat more efficient. A hardlink is just another name for a file, so all the hardlinks pointing to the same file are equally fast. (Since they are the same file.) For a soft link you first need to read the soft link to get the name of the file it points to, and then find that file. For a hardlink you only need the second step. I would also expect a hardlink to use less space in a directory than a softlink. > > -Adam > > > >> (08.02.2002 @ 1844 PST): Steve Mazerski said, in 0.4K: << > > > > Is there any particular reason why FreeBSD makes frequent use > > of hard links instead of soft links when defining "alternative" > > names for commands and other files? > > > > e.g. /usr/bin/nvi and /usr/bin/vi are the same file. > > > > Linux distros tend to use soft links for the same thing. > > > > Just wondering > > > > S.Mazerski -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message