Skip to main content


ln -s [one]

[two]the arguments are done in the same order as if you would have done it with cp.

Yes, it really is that easy. You can stop worrying about it now.

Mikołaj Hołysz reshared this.

in reply to daniel:// stenberg://

I discovered this too a few years ago, and life has never been as smooth! ❤️
in reply to daniel:// stenberg://

how come this never sticks. I never managed to make this connection for some strange reason.

So instead, my approach for years was always "ln -s a b && ls -l".

And now, I just imagine myself doing the above, and then remember that "b" always came out.

It means I spend a few seconds before running the command, every time.

I never had this issue for cp, wonder why

in reply to daniel:// stenberg://

I always imagine softlinks as text file containing the source path.
i.e.
ln -s [source] [dest]
as
echo [source] > [dest]

Helps understand relative path symlinks easily

in reply to daniel:// stenberg://

this does not help, my mind will keep going to the sad and confused place every time I use ln. I’m only 30 years in, I hope to one day master it like you.
in reply to daniel:// stenberg://

I remember it as "if I leave off the second argument, it will create a link with the same name as the origin"
in reply to daniel:// stenberg://

Except some people don't think the two are equivalent.
`cp one two` copies one to two` `ln -s one two` makes two a symlink of one; yes, the second is "made like the first" with that command, and it's logical that the "new" thing is the second argument.
There's an argument to be made that it's logical to say "I want a link named foo to point at bar" instead of "I want a link for bar that is called foo".
ln's straightforward, but command "etymology", for lack of a better word, matters.
in reply to daniel:// stenberg://

a useful memnonic for both 'ln' and 'cp' is

"What you want, where you want it."

in reply to daniel:// stenberg://

OMG what a great memory hook. I always wonder, this will fix it in my brain. I owe you a beverage of your choice.
in reply to daniel:// stenberg://

I think that the reason why so many people, including myself, are confused by ln lies in the phrasing of the manpage. There they correctly speak of the target of a link, but this is highly confusing if you try to match it with cp where target is naturally understood, well, as the place where the new copy will be put.
in reply to daniel:// stenberg://

the issue I have with it is that my brain stored the following association: `ln -s [target] [target]`