Skip to main content
Spell out that the number of links is shown in the `ls -l` output.
Source Link
Stephen Kitt
  • 457.8k
  • 58
  • 1.2k
  • 1.3k

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

However, hard links aren’t involved here., as indicated by the link count of 1 in ls -l’s output:

$ ll -i /usr/bin/bash /bin/bash  
1310813 -rwxr-xr-x 1 root root 1183448 Jun 18 21:14 /bin/bash*  
1310813 -rwxr-xr-x 1 root root 1183448 Jun 18 21:14 /usr/bin/bash*

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.

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.

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

However, hard links aren’t involved here, as indicated by the link count of 1 in ls -l’s output:

$ ll -i /usr/bin/bash /bin/bash  
1310813 -rwxr-xr-x 1 root root 1183448 Jun 18 21:14 /bin/bash*  
1310813 -rwxr-xr-x 1 root root 1183448 Jun 18 21:14 /usr/bin/bash*

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.

Explain why I’m using `-xdev`.
Source Link
Stephen Kitt
  • 457.8k
  • 58
  • 1.2k
  • 1.3k

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.

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

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.

Make it explicit that this doesn’t involve hard links.
Source Link
Stephen Kitt
  • 457.8k
  • 58
  • 1.2k
  • 1.3k

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

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

Your problem arises because of a symlink, the bin symlink which points to usr/bin. 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

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
Source Link
Stephen Kitt
  • 457.8k
  • 58
  • 1.2k
  • 1.3k
Loading