Live data from Hacker News

I always forget the argument order of the `ln -s` command

reddit.com

1–10 of 127 posts

Re: I always forget the argument order of the `ln -s` command

#3
post #2

I 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

#5
As 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

#10
Does 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.
Post reply on HN