Live data from Hacker News

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

reddit.com

21–30 of 127 posts

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

#21
post #8

My 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?

"I want to make a symbolic to this "

"I want to copy this to this "

vs.

"I want this to be accessible via this "

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

#22
post #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.

It's similar to all the file I/O functions that always have the file descriptor first (fprintf etc). These are the heart of Unix. Remember the Unix philosophy: Everything is a file.*

* for a slightly smaller definition of everything than in Plan9

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

#28
post #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.

This is a crime against usability IMO. Another comment mentioned that tar takes arguments as "target source" rather than "source target".

Ever notice that for everything in the world that screws, like valves or screws or bottle caps, counter-clockwise loosens and clockwise tightens? How is it we got the whole world to agree on that convention, but software is 50/50 on how we order the source and destination?

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

#30
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.

It's so similar to cp that GNU cp has

  cp -l from to
Post reply on HN