I've read this link, now I simply want to know why there are lots of hard link in /usr
.
For example, in my Ubuntu server, installed git
, I found the command git
here: /usr/bin/git
. I execute ls -l /usr/bin/git
and get the output as below:
-rwxr-xr-x 119 root root 11178080 Mar 6 03:48 /usr/bin/git
As you see, there are 119 hard links...
Why do we need 119 hard links here? More generally speaking, as we have the environment variable PATH
and the executable files have been put into /usr/bin/
, also, we can create soft links for some reason of compatibility, we can execute them anytime and anywhere, why are there some hard links in usr
?
Part of output of find /usr -samefile /usr/bin/git
:
/usr/libexec/git-core/git-prune
/usr/libexec/git-core/git-diff-index
/usr/libexec/git-core/git-ls-remote
/usr/libexec/git-core/git-merge-recursive
/usr/libexec/git-core/git-push
/usr/libexec/git-core/git-update-index
/usr/libexec/git-core/git-check-mailmap
/usr/libexec/git-core/git-interpret-trailers
/usr/libexec/git-core/git-archive
/usr/libexec/git-core/git-upload-archive
/usr/libexec/git-core/git-rev-parse
/usr/libexec/git-core/git-ls-files
/usr/libexec/git-core/git-am
All of hard links of /usr/bin/git
are found in /usr/libexec/git-core/
.
1
there. ... in fact, the only files which have hard links in my/usr/bin
are a bunch of perl commands andpython3.5
, and that's probably some quirk of Perl and Python installation process. – muru Mar 06 '18 at 03:34/usr/bin/git
, to/usr/bin/git{,-receive-pack,-upload-archive}
, and on Debian I have only one. – Sparhawk Mar 06 '18 at 04:30find /usr -samefile /usr/bin/git
should give you a list. The git package doesn't have them itself so I'm curious what does. – Michael Homer Mar 06 '18 at 04:39git
binary makes it seem like this was installed from source, unstripped... – Stephen Kitt Mar 06 '18 at 05:36