Skip to main content
deleted 2 characters in body
Source Link
samshers
  • 748
  • 1
  • 10
  • 29

Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file.

$ 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*
                   ^

above is as expected - cool --> both files point to same inode 1310813
(but the number of links, indicated by ^, shows to be 1. From StephensGilles answer the reason for this can be understood)

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

above is as expected - so no problems.

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

above is NOT cool. How do I trace the original file or every hardlink using the /usr/bin/bash file as reference?

Strange - below did not help either.

$ find / -inum 1310813 2>/dev/null
/usr/bin/bash

Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file.

$ 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*
                   ^

above is as expected - cool --> both files point to same inode 1310813
(but the number of links, indicated by ^, shows to be 1. From Stephens answer the reason for this can be understood)

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

above is as expected - so no problems.

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

above is NOT cool. How do I trace the original file or every hardlink using the /usr/bin/bash file as reference?

Strange - below did not help either.

$ find / -inum 1310813 2>/dev/null
/usr/bin/bash

Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file.

$ 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*
                   ^

above is as expected - cool --> both files point to same inode 1310813
(but the number of links, indicated by ^, shows to be 1. From Gilles answer the reason for this can be understood)

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

above is as expected - so no problems.

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

above is NOT cool. How do I trace the original file or every hardlink using the /usr/bin/bash file as reference?

Strange - below did not help either.

$ find / -inum 1310813 2>/dev/null
/usr/bin/bash
pointed out the number of hardlinks which is equal to 1
Source Link
samshers
  • 748
  • 1
  • 10
  • 29

Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file.

$ 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*
                   ^

above is as expected - cool --> both files point to same inode 1310813
(but the number of links, indicated by ^, shows to be 1. From Stephens answer the reason for this can be understood)

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

above is as expected - so no problems.

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

above is NOT cool. How do I trace the original file or every hardlink using the /usr/bin/bash file as reference?

Strange - below did not help either.

$ find / -inum 1310813 2>/dev/null
/usr/bin/bash

Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file.

$ 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*

above is as expected - cool --> both files point to same inode 1310813

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

above is as expected - so no problems.

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

above is NOT cool. How do I trace the original file or every hardlink using the /usr/bin/bash file as reference?

Strange - below did not help either.

$ find / -inum 1310813 2>/dev/null
/usr/bin/bash

Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file.

$ 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*
                   ^

above is as expected - cool --> both files point to same inode 1310813
(but the number of links, indicated by ^, shows to be 1. From Stephens answer the reason for this can be understood)

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

above is as expected - so no problems.

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

above is NOT cool. How do I trace the original file or every hardlink using the /usr/bin/bash file as reference?

Strange - below did not help either.

$ find / -inum 1310813 2>/dev/null
/usr/bin/bash
added 43 characters in body
Source Link
samshers
  • 748
  • 1
  • 10
  • 29

Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file.

$ 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*

above is as expected - cool --> both files point to same inode 1310813

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

above is as expected - so no problems.

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

above is NOT cool. How do I trace the original file or every hardlink using the /usr/bin/bash file as reference?

Strange - below did not help either.

$ find / -inum 1310813 2>/dev/null
/usr/bin/bash

Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file.

$ 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*

above is as expected - cool

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

above is as expected - so no problems.

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

above is NOT cool. How do I trace the original file or every hardlink using the /usr/bin/bash file as reference?

Strange - below did not help either.

$ find / -inum 1310813 2>/dev/null
/usr/bin/bash

Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file.

$ 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*

above is as expected - cool --> both files point to same inode 1310813

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

above is as expected - so no problems.

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

above is NOT cool. How do I trace the original file or every hardlink using the /usr/bin/bash file as reference?

Strange - below did not help either.

$ find / -inum 1310813 2>/dev/null
/usr/bin/bash
grammar and formatting tweaks
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264
Loading
Became Hot Network Question
Source Link
samshers
  • 748
  • 1
  • 10
  • 29
Loading