Linux – How to Create a Relative Symbolic Link

command linelinuxsymbolic-link

I need a symlink that resolves relative to the directory it is placed in. What command is used to create such a thing?

Best Answer

  1. Go to the directory you want the link to reside in
  2. Run the command ln -s ../some/other/file linkname

The path you provide is stored with the file. When you access the file the stored path is looked up and expanded relative to the file. It does not know what directory you were in when you created the link.

Related Question