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.
The problem with "from" and "to" is - which is the from and which is the to? Is the "from" the file/dir I want to copy "to" a link? Or is the "from" the name of a link I want to point "to"? The dual meaning of some terms that the concept of links and making links creates causes a lot of this confusion, IMHO. Are we using terminology that refers to the act of creating the link or that refers to the direction of the li…
I always forget the argument order of the `ln -s` command
61–70 of 127 posts
Re: I always forget the argument order of the `ln -s` command
#62I 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
#63My 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?
At least for me, it's because I say in my head "link $FOO to $BAR", which must be typed "ln -s $BAR $FOO".
Re: I always forget the argument order of the `ln -s` command
#64Earlier quoted context omitted.
tar is like that because of command lines tar [args] [one thing] [list of things] it'd be wierd if it was tar [args] [list of things] [filename] ... but i will admit i frequently make that mistake.
But, as a counterpoint, if you want to copy several things to a folder, you do: cp [args] [list of things] [destination folder]
cp [args] -t [destination folder] [list of things]
The same is true of mv. This is useful if you are piping filenames to xargs.Re: I always forget the argument order of the `ln -s` command
#65I 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.
`$ ln -s link_from link_to` would imply the reverse behavior. How does a symlink point from the actual file to the thing-that-looks-like-a-file-but-is-really-a-symlink? The file doesn't even know whether there are symlinks pointing to it.
Applying your definitions of "link from" and "link to", this:
Re: I always forget the argument order of the `ln -s` command
#66Does 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.
Probably in order to be consistent with assignment.
Re: I always forget the argument order of the `ln -s` command
#67Earlier quoted context omitted.
The problem with "from" and "to" is - which is the from and which is the to? Is the "from" the file/dir I want to copy "to" a link? Or is the "from" the name of a link I want to point "to"? The dual meaning of some terms that the concept of links and making links creates causes a lot of this confusion, IMHO. Are we using terminology that refers to the act of creating the link or that refers to the direction of the li…
"to" is an entity that doesn't exist yet.
And people say Linux isn't user-friendly! :)
Re: I always forget the argument order of the `ln -s` command
#68* The arguments order is just the opposite of common sense. It has taken me years to really remember it, and I still have to think a little every time I use it.
* The default is to create hard link, which you almost never want. And if you do want them, you are probably doing it wrong. Making hard links is just asking for trouble.
I've read that Plan9 has somewhat corrected this whole problem. At least there is no ln command at all. Instead one uses bind, mount, and unmount. Of which bind is most similar to ln -s, but with arguments in reversed order.
Re: I always forget the argument order of the `ln -s` command
#69ln -s file Always remember that. Pointing left. The symlink is pointing at the file.
Re: I always forget the argument order of the `ln -s` command
#70I 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.
This phrasing confused me more. `$ ln -s link_from link_to` would imply the reverse behavior. How does a symlink point from the actual file to the thing-that-looks-like-a-file-but-is-really-a-symlink? The file doesn't even know whether there are symlinks pointing to it. Applying your definitions of "link from" and "link to", this: Google http://google.com/>Google ; creates a link from google.com to the hyperlink on y…
It took me a long time till I realized that saying it thus made me always recall it properly.