I am using volumes that are mounted at different path locations at each boot.

I would like to create symbolic links on the volumes that link to other folders within the same volumes, without them breaking if the volume is mounted to a different path.

Is it possible to create a symbolic link to a directory, but using path related to existing path instead of full path, ex: ../../myFolderHere instead of having to use /home/someFolder1/someFolder2/myFolderHere ?


Sure, the syntax is:

ln -s ../../origFolder/Filename newSymLink

If you want to ensure that the link is relative use ln -sr

man ln

-r, --relative - create symbolic links relative to link location
-s, --symbolic - make symbolic links instead of hard links

From /home/someFolder1/someFolder2/someFolder3/someFolder4, you can do:

ln -s ../../myFolderHere .

And have it work as you expect.

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.