How to create a link with an absolute path in Linux? [closed]
Asked Answered
K

1

5

By using "ln -s a b", it creates a soft-link from b to a with a relative path. If 'b' is moved to another directory, it would get broken.

Is there any way so I can create an link with an absolute path?

Kirkpatrick answered 18/1, 2014 at 4:48 Comment(3)
Use the absolute path?Varian
This question belongs on Superuser.Colettecoleus
Also, do that in your terminal man ln. It will save you many headaches in the future.Varian
C
7

Simply use the full path to the link target:

ln -s /full/path/to/a b
Colettecoleus answered 18/1, 2014 at 4:54 Comment(1)
To get full path, use "readlink -f". Put simply: ln -s `readlink -f a` bHavstad

© 2022 - 2024 — McMap. All rights reserved.