Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Feb 2020 02:08:23 +0100
From:      Polytropon <freebsd@edvax.de>
To:        "Steve O'Hara-Smith" <steve@sohara.org>
Cc:        freebsd-questions@freebsd.org, Polytropon <freebsd@edvax.de>
Subject:   Re: rm | Cleaning up recycle bin
Message-ID:  <20200224020823.2462aad4.freebsd@edvax.de>
In-Reply-To: <20200223182411.81a22ce74509b8778a39d8d3@sohara.org>
References:  <a589bf69-a53b-a732-08ff-74e09b723bbd@cloudzeeland.nl> <20200223184908.b35d656a.freebsd@edvax.de> <20200223182411.81a22ce74509b8778a39d8d3@sohara.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 23 Feb 2020 18:24:11 +0000, Steve O'Hara-Smith wrote:
> 	Multiple entries for the same file are quite common for binaries,
> for example /bin/csh and /bin/tcsh are links to the same file, or for that
> matter nearly everything in /rescue is a link to the same file. When there
> are multiple links to a file none of them are special, they're all just
> links.

Technically, they serve a very specific purpose: When a program
is invoked, it can query argv[0] for the name it was called with.
In case of "csh" vs. "tcsh", this can affect the shell's behaviour.
It's even more obvious for all the programs in /rescue, where
for example "cp" and "ps" point to the same binary, but make that
binary do totally different things when invoked.

While a symbolic link (symlink) is, as their name suggests,
just a symbolic name for a different file or directory, a
hardlink is actually just an additional name for a file,
and there is no precedence in hard links (like with symlinks,
"_this_ is a reference, but _that_ is the original); they're
all originals. That's why a hardlink can never cross the
border of a filesystem, while a symlink can.



On Sun, 23 Feb 2020 18:58:18 -0600, Valeri Galtsev wrote:
> Thank you, Steve! Very educational. We (I at least) sometimes
> forget fundamentals.

That's why my little addition for educational completeness. ;-)




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200224020823.2462aad4.freebsd>