Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 9
    File system designs tend to make it simple to map a path to an inode; that's the primary purpose of a file system. The other direction, though, typically isn't tracked. The only real way to find all paths that map to a given inode is to check all candidate paths. Commented Sep 3, 2020 at 13:29
  • 2
    As noted elsewhere, you don't actually have a hardlink here. Assuming you have GNU readlink (which you should on Linux, but not necessarily on other *nix platforms), note that readlink -f will fully canonicalize a path... which, in this instance, would reveal that the canonical path of /bin/bash is indeed /usr/bin/bash. Commented Sep 3, 2020 at 15:30
  • @Matthew but that doesn’t help with the problem the OP is ultimately trying to solve, finding the package which owns /usr/bin/bash (which is installed as /bin/bash). The canonical location from readlink’s perspective doesn’t match the canonical location from the package manager’s perspective. That’s why the OP is looking for links to /usr/bin/bash, not what /bin/bash links to. Commented Sep 4, 2020 at 4:49
  • @StephenKitt, that sounds like a package manager problem. rpm identifies bash-5.0.17-1.fc32.x86_64 as the owner of both /bin/bash and /usr/bin/bash. Anyway, I don't see that information in the question, so expecting me to be aware of it isn't very reasonable. Commented Sep 4, 2020 at 12:41
  • 1
    Does this answer your question? What happens when you copy a hardlink? Commented Sep 4, 2020 at 14:57