skip to Main Content

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

Answers


  1. 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.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search