difference between /bin/ls and /usr/bin/ls

2.7k Views Asked by At

It seems that both /bin/ls and /usr/bin/ls have the same inode (and the same sha-256 hash) but the number of hard links displayed by ls -li /usr/bin/ls /bin/ls is 1 instead of 2 :

user@debian:~/Documents/Unix$ ls -lai /usr/bin/ls /bin/ls
8258848 -rwxr-xr-x 1 root root 147176 24 sept.  2020 /bin/ls
8258848 -rwxr-xr-x 1 root root 147176 24 sept.  2020 /usr/bin/ls

Could somebody explain me what I have misunderstood?

2

There are 2 best solutions below

0
Thomas On BEST ANSWER

I was puzzled for a while by this too, until I discovered this:

$ ls -ld /bin
lrwxrwxrwx 1 root root 7 May 31 02:39 /bin -> usr/bin

So /bin is just a symlink to /usr/bin, and there is really only one link to the file.

0
Dzemo997 On

There are no differences between ls utility. You should know the difference is only between /bin and /usr/bin directories. /bin directory contains all programs that are used by system admin and all others users. /bin directory we can access whenever we want, but /usr/bin is accessible only for users that are locally logged.