I'm trying to create a symbolic link in my home directory that points to a directory on my external HDD.
It works fine when I specify it like this:
cd ~
ln -s /run/media/name/exhdd/Data/ Data
However it creates a faulty link when I try this:
cd /run/media/name/exhdd
ln -s Data/ ~/Data
This creates a link that I cannot cd
into.
When I try, bash complains:
bash: cd: Data: Too many levels of symbolic links
The Data symbolic link in my home is also colored in red when ls
is set to display colored output.
Why is this happening? How can I create a link in that manner? (I want to create a symlink to a directory in my working directory in another directory.)
Edit: according to this StackOverflow answer, if the second argument (in my case that'd be ~/Data) already exists and is a directory,
ln
will create a symlink to the target inside that directory.
However, I'm experiencing the same issue with:
ln -s Data/ ~/
cd ~
is usually the same ascd
.ls -l ~/Data
would have helped you see what was wrong with the "red" link.cat
it, but I forgot what was the result... (I'm not home at them moment.)/run/media/name/exhdd/Data/
toData
then use the followingln -s /run/media/name/exhdd/Data/* Data