$ touch file1.txt
$ ln -sf file1.txt file2.txt
$ ls -l
total 0
-rw-r--r-- 1 alexlai alexlai 0 Nov 19 07:34 file1.txt
lrwxrwxrwx 1 alexlai alexlai 9 Nov 19 07:34 file2.txt -> file1.txt
$ touch file0.txt
$ ln -sf file0.txt file1.txt
$ ls -l
total 0
-rw-r--r-- 1 alexlai alexlai 0 Nov 19 07:41 file0.txt
lrwxrwxrwx 1 alexlai alexlai 9 Nov 19 07:41 file1.txt -> file0.txt
lrwxrwxrwx 1 alexlai alexlai 9 Nov 19 07:34 file2.txt -> file1.txt

Great, we got the path to the original file, but what if I told you that “file1.txt” is another soft link?

Confused? But it’s true, and it’s also quite possible that the next file will be another soft link, so tools like “ls” are not that effective in this type of situation where you want the exact path of the original file from the deeply nested soft link.

[alexlai@x8664Arch tmp]$ cd
[alexlai@x8664Arch ~]$ readlink /home/alexlai/build/tmp/file1.txt 
file0.txt
[alexlai@x8664Arch ~]$ readlink -f /home/alexlai/build/tmp/file1.txt 
/home/alexlai/build/tmp/file0.txt