$mkdir lnTest1 lnTest2

$ln -s lnTest1 "lnTest2" There is NO slash at the end of "lnTest2"!!

$ls lnT* -Rl |sed "s'$USER''g"
lnTest1:
total 0

lnTest2:
total 0
lrwxrwxrwx 1   7 Jun 22 22:48 lnTest1 -> lnTest1
  • what is the question? – Lyndon White Jun 23 '14 at 2:12
  • I was trying a way to ask a question without wording it :) – Aquarius Power Jun 23 '14 at 3:51
up vote 7 down vote accepted

When the last argument to ln is a directory, the links are made in that directory. The man page says:

SYNOPSIS

    ln [OPTION]... TARGET... DIRECTORY     (3rd form)

In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.

It doesn't matter whether you're creating a hard or symbolic link. cp and mv behave similarly.

  • 2
    I think than an alias ln='ln -T' could be a workaround, but then it would fail if I want an actual directory be recognized as such; And even if I use / at the end, it still doesnt accept the directory... so the best is know about -T ln option and use it properly, I just saw cp and mv have the same option for the exactly same purpose, thx! – Aquarius Power Jun 23 '14 at 3:56

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.