I always forget the argument order of the `ln -s` command
1–10 of 127 posts
Re: I always forget the argument order of the `ln -s` command
#2I used to have this problem. Then I realized that if I want to really copy a file, I type
$cp file_from file_to
and that
$ln -s link_from link_to
has a very similar effect to the cp command above. I haven't messed this up ever since.
Re: I always forget the argument order of the `ln -s` command
#3I used to have this problem. Then I realized that if I want to really copy a file, I type $cp file_from file_to and that $ln -s link_from link_to has a very similar effect to the cp command above. I haven't messed this up ever since.
I used to have this problem too, and then I read the linked article and now remember the relationship between ln and cp and never got it wrong since.
Also I wonder how many people can say the same thing as the article and still get upvoted.
Re: I always forget the argument order of the `ln -s` command
#4That's funny, I do too. I always thought it was just me...
Re: I always forget the argument order of the `ln -s` command
#5As someone who always had that problem, I think it's because I always mentally picture a command as saying "do from to ", ie, "copy this file to that file". But this construct doesn't hold up for linking, so I just have to remember it arbitrarily by remembering cp. function(src, dest) just generally seems to be the unofficial "right way" of ordering things.
Re: I always forget the argument order of the `ln -s` command
#6Yeah it seems backwards to me as well. I always thought it was the only one.
Re: I always forget the argument order of the `ln -s` command
#7The annoying thing is that the mklink command in Windows uses the opposite order, so you have to do
mklink link_to link_from
EDIT: formatting.
Re: I always forget the argument order of the `ln -s` command
#8My god, this thing always keeps biting me. It seems so obvious now with that cp-mnemonic. But it makes me wonder, why does everyone do it wrong in the first place?
Re: I always forget the argument order of the `ln -s` command
#9Ditto. I just remember that it's the reverse of tar, but the cp trick is better.
Re: I always forget the argument order of the `ln -s` command
#10Does anyone know why C calls like 'strcpy' and 'strcat' are the opposite of this?
strcat(target, source)
strcpy(target, source)
But, in SH... cp source target
I feel like these things were developed around the same time, by the same community. I've always wondered if there was a reason for the different perspective.