Skip to main content
3 of 4
Explain why I’m using `-xdev`.
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

First, there is no original file in the case of hard links; all hard links are equal.

However, hard links aren’t involved here. Your problem arises because of a symlink, the bin symlink which points to usr/bin. To find all the paths in which bash is available, you need to tell find to follow symlinks, using the -L option:

$ find -L / -xdev -samefile /usr/bin/bash 2>/dev/null
/usr/bin/rbash
/usr/bin/bash
/bin/rbash
/bin/bash

I’m using -xdev here because I know your system is installed on a single file system; this avoids descending into /dev, /proc, /run, /sys etc.

Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k