News for hackers. Stuff that matters.
Re:Everything I googled in a week as a professional software... by reginaldo on Friday September 06, 2019 @01:21PM (#20897603)
Here's how I finally memorized it: ln has a 1-file-argument invocation, so ln -s ../../a_fine_file will create a symbolic link to that file under the current directory and under the "a_fine_file" file name. The single argument case has to have the file you want to link to as input. That generalizes nicely as the 2-file-argument invocation maintaining the logic.
Re:Everything I googled in a week as a professional software... by nikconwell on Saturday September 07, 2019 @05:18AM (#20902713)
A guy in the office always remembers it as remembering that wedding saying - something old, something new, something borrowed, something blue. Whenever he did a symlink he would always say out loud something old, something new, ... That has stuck with me as well for all these years so I've never needed to figure out which was which, I always just knew it.
Re:Everything I googled in a week as a professional software... by throwaway744678 on Friday September 06, 2019 @02:20PM (#20898261)
Ha! My trick is to

  ln -s a b
then look at the link with ls -l, then remove my garbage! Your way is much better.
Re:Everything I googled in a week as a professional software... by TACIXAT on Friday September 06, 2019 @02:34PM (#20898412)
I just do it the one way, get the error that the destination already exists, then swap them.
Re:Everything I googled in a week as a professional software... by hanspeter on Saturday September 07, 2019 @03:24AM (#20902341)
I think most people just feel this is risky. What if you overwrite your file? If it was a cp command, that's what would happen.
Re:Everything I googled in a week as a professional software... by skzo on Friday September 06, 2019 @06:09PM (#20900338)
Me too, I was starting to think I was the crazy one after reading the other comments :)
Re:Everything I googled in a week as a professional software... by account42 on Monday September 09, 2019 @04:39AM (#20916256)
Except if b is a directory, then ln -s a b will create a symlink at b/a which points to a.
Re:Everything I googled in a week as a professional software... by taftster on Friday September 06, 2019 @03:10PM (#20898809)
Yup, exactly. I always use the form:

  ln -s ../../a_fine_file .
With the added '.' at the end. That way, I can remember to change the period out if I don't want the same name (or if I'm linking in the same directory).
Re:Everything I googled in a week as a professional software... by vehementi on Friday September 06, 2019 @06:33PM (#20900468)
Sounds like you're making bold assumptions about people's beliefs about whether the extra argument would go before or after the existing argument :)
Re:Everything I googled in a week as a professional software... by psutor on Friday September 06, 2019 @01:46PM (#20897860)
That's how I memorized it too! Really struggled with it until I started thinking of it that way.
Re:Everything I googled in a week as a professional software... by Noumenon72 on Friday September 06, 2019 @09:29PM (#20901218)
What do you all use symbolic links for so much that you would need to memorize it?
Re:Everything I googled in a week as a professional software... by munificent on Friday September 06, 2019 @01:24PM (#20897637)
Thank you, this is really helpful.
Re:Everything I googled in a week as a professional software... by aloknnikhil on Friday September 06, 2019 @01:27PM (#20897668)
Interesting. Thanks, that's helpful. It's also a necessary approach for using relative paths as targets when you refer to the current directory to add the link in.
Re:Everything I googled in a week as a professional software... by anilakar on Saturday September 07, 2019 @04:00AM (#20902459)
I use a similar rule for those git commands that either take one or two branch names. The latter one must obviously be the current branch by default.
Re:Everything I googled in a week as a professional software... by autoexec on Friday September 06, 2019 @04:26PM (#20899566)
and now I've just memorized it myself. Thanks!