I was "playing around" and messed up my install of pip (Python package manager). Anyhow, it turns out, in my system /bin/pip
is (?) a hard link of /usr/bin/pip
(or the other way around, since I'm told with hard links there is no notion of which file is the original).
$ realpath /bin/pip /usr/bin/pip
/usr/bin/pip
/usr/bin/pip
The results of realpath
have me confused. If there is no notion of which file is the original, why does realpath
display /usr/bin/pip
instead of /bin/pip
for /bin/pip
?
I know either may be a hard link because:
$ stat -c "%n is a %F pointing to inode %i, which has %h hard link(s)" /bin/pip /usr/bin/pip
/bin/pip is a regular file pointing to inode 152837, which has 1 hard link(s)
/usr/bin/pip is a regular file pointing to inode 152837, which has 1 hard link(s)
Just in case, my machine is running CentOS 7 and my realpath command comes from GNU coreutils 8.22.
-------- EDIT -------
Indeed, /bin is a symlink pointing to /usr/bin, while /usr/bin is a regular directory:
$ ls -ld /bin /usr/bin
lrwxrwxrwx. 1 root root 7 May 15 12:49 /bin -> usr/bin
dr-xr-xr-x. 2 root root 53248 Jul 13 18:44 /usr/bin
/bin
is symlink to/usr/bin
/bin/pip
and/usr/bin/pip
were hardlinks to the same diskfile, it would show as2 hard link(s)
for each in your output./bin
is a symlink, then the files under/bin
are actually in/usr/bin
! If you dols -l /bin /usr/bin
you should get two identical sets of output. The files all exist in the same directory -/usr/bin
.