0

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?

cmdEvo
  • 23
  • 4
  • Questions about operating systems, their utilities, networking and hardware, are off topic here. [What topics can I ask about here?](https://stackoverflow.com/help/on-topic). Please delete this and ask, instead, on https://unix.stackexchange.com/ or, in this case, https://superuser.com/ – Rob Sep 12 '21 at 10:16

2 Answers2

4

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.

Thomas
  • 174,939
  • 50
  • 355
  • 478
1

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.

Dzemo997
  • 328
  • 2
  • 5