I've been admining Linux systems for 25 years, and I still have to check which one it is every time.
I appreciate people saying that it's like `cp` or `mount`, but in my head the natural order of thinking about this operation is reversed: it's "create a link to this file" not "make this file also known as this link." Hence two competing "gut feelings" about which should come first. It also doesn't help that commands like "alias" work the opposite direction ("make a new command that is actually this another command").

Anyway, it was really just an observation that I confuse this all the time, and I'm not the greenest Linux admin around. :)
@monsieuricon i think of it as an html hyperlink
<a href="link">link</a>

@monsieuricon yup, 30 years of Unix/Linux daily use and I still fail this one. Reminds me of USB Type-A 50% chance of plugging it wrong, but failing it *every* time.

BTW, @bagder started a separate thread on this and people are mostly getting it right on the first try - smh...

https://mastodon.social/@bagder/112220659572117434

@denix @monsieuricon @bagder Oh, it's more than that. You have to try 3 times to plug in USB-A. And it's the same for ln. Neither order works the first time.

@denix @monsieuricon @bagder

USB always needs three attempts:

1. Wait, this feels awkward, better try the other way round.
2. No, that's _definitely_ wrong. It _has_ to be the other way round.
3. Ahh...

@monsieuricon I had the same issue for a while.

Especially since I rarely use ln. I try to convince my brain that "-s" would mean "source" even though I know it actually means "symbolic link", just so I remember that the first argument right after the "-s" option is the existing, "source" file.

@monsieuricon 100%. Saying it’s like cp is not helpful as my mental model is the link going the other way (i.e. a link that points to the real file)
@monsieuricon With time everything will fit in place, your gut feelings will be gone, and ln will behave like cp.
(BTW: alias is different: it has a single parameter that is an assignment)

@monsieuricon

Yeah, when I say it's like cp, that doesn't mean it's intuitive. I just have to repeat the mantra.

@monsieuricon I for one suffer the same but because I remember it is the other way around a get confused and have to look :) If there was a system wide config to set it in one of the ways!
@monsieuricon i'm kind of fascinated that people think it worthwhile to try to school *you* of all people, if even @monsieuricon has trouble with this, the problem is not with @monsieuricon, it's with the damn thing :)
@monsieuricon I think of it like cp/mv because the order is "existing thing" "new thing"
@tjk @monsieuricon that's a good way to remember because I think the confusion is that a symlink itself points to a target thing so is the source the symlink itself that points or is thw source the real file and the target the symlink you want to create?

@monsieuricon @dgar every single time - my command history is:

$ man ln

$ ln -s blah blah

Cannot make it stick.

@monsieuricon I feel like we could afford to make a better convention for these tools. Like using > to indicate directionality (I know that's used for redirection, though) or... something. What sort of hints could make these tools easier to use?

@monsieuricon haha while i'm in the "bro it's like cp(1)" crowd, i can appreciate where you're coming from because of memcpy(dest,src, ..).

i tend to find myself in this situation when it comes to unfamiliar assembly syntaxes, or even at&t vs. intel -- is it like cp(1) or is it like memcpy(3)

@monsieuricon my mental model for all commands is that the first file is input, second is output. That said i have always had problems memorizing linux command names and arguments and need to look most of them up…
@monsieuricon I actually remembered this 20 years ago because I gave the -s the alternative meaning of "source". So if you think it like this, you'll never be wrong

@monsieuricon Yes, it's a Sapir-Whorf thing. Some languages are verb-subject-object, and some are verb-object-subject. Yoda even speaks object-subject-verb (in the original, anyway; it's trickier in the German translation).

Don't think of it as a matter of abstract intuition, but as a matter of foreign language intuition. The intuition of consistency, not the intuition of essence.

@monsieuricon In CP/M, copying used to go the other way: pip destination=source. If Unix has been modelled after that, we'd be doing hard links by pip destination<=souce, and symlinks as pip destination<-source.
@riley @monsieuricon oh I missed this comment and posted mine… (CP/M was my ā€˜first’ OS)
@mia FWIW, I kind of suspect that CP/M's PIP was, in turn, modelled after something that DEC used to ship with PDP-11, the cradle of OSes. Even Unix comes from it!
@monsieuricon
@monsieuricon It won’t help, but in the olden days (at least), mv, cp & ln were all links to the same binary, which examined its argv[0] to see how it was invoked. That was such a weird hack that it’s been easy (for me) to remember all these decades later.
@monsieuricon @monsieuricon how about this trick: it’s ā€œtarget linknameā€ because linkname can be omitted for the link to get the same file name and that wouldn’t work the other way around.