Here is the sample

$ mkdir original_dir
$ ln -s original_dir link
$ ls -l
link -> original_dir

Now I want to create a new link to original_dir by linking to link, how can I do that

$ ln [--link-to-original-file] link newLink

Or any other commands that do the same thing?

  • ln -s "$(readlink -f link)" newlink, but most of the time ln -s link newlink would work exactly the same. – Satō Katsura Jun 15 '17 at 5:50

You need to create a symbolic link by using readlink as suggested by @SatoKatsura:

ln -s "$(readlink -f link)" newLink

If you create a simple symbolic link via ln -s link newLink, newLink would point to link, which itself points to original_dir.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.