There are two directories A
and B
and a file F
which is located in B
. The working directory is B
.
How can you create a symbolic link in A
pointing to F
in B
without changing the directory?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityThere are two directories A
and B
and a file F
which is located in B
. The working directory is B
.
How can you create a symbolic link in A
pointing to F
in B
without changing the directory?
ln -s $(pwd)/F /full/path/to/A/link
Just supply the absolute path to both the file you want to link to and the the new symlink file. You can use pwd
as a shortcut for your current path (e.g. B
).
Try This (in bash);
ln -s $(pwd)/${F} ${A}
Or this syntax in other shells
ln -s `pwd`/${F} ${A}