Why are my links going in the wrong place?

Dotan Cohen dotancohen at gmail.com
Tue Dec 28 15:26:21 UTC 2010


For some reason it seems that symbolic links are being created in the
target directory, instead of the current directory. Why? What am I
doing wrong?

For instance, I am in a directory with a single subdirectory, in which
there exists a single file:
✈ecd:test$ ls -l
total 0
drwxr-xr-x 2 dotancohen dotancohen 16 2010-12-28 17:14 target
✈ecd:test$ ls -l target/
total 4
-rw-r--r-- 1 dotancohen dotancohen 15 2010-12-28 17:14 file

Now I create a symbolic link in the current directory to the subdirectory:
✈ecd:test$ ln -s link target/

But it gets placed in the subdirectory instead of in the current directory:
✈ecd:test$ ls -l
total 0
drwxr-xr-x 2 dotancohen dotancohen 24 2010-12-28 17:15 target
✈ecd:test$ ls -l target/
total 4
-rw-r--r-- 1 dotancohen dotancohen 15 2010-12-28 17:14 file
lrwxrwxrwx 1 dotancohen dotancohen  4 2010-12-28 17:15 link -> link

Even when I explicitly state "current directory" the system tries to
put the link in the subdirectory (the target directory):
✈ecd:test$ ln -s ./link target/
ln: creating symbolic link `target/link': File exists
✈ecd:test$

Why? What am I doing wrong?

Thanks!

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com




More information about the ubuntu-users mailing list