6 ms·
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 di
by reginaldo 7y ago
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.
- munificent 7y agoThank you, this is really helpful.
- aloknnikhil 7y agoInteresting. 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.
- psutor 7y agoThat's how I memorized it too! Really struggled with it until I started thinking of it that way.
- Noumenon72 7y agoWhat do you all use symbolic links for so much that you would need to memorize it?
- throwaway744678 7y agoHa! 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.
- TACIXAT 7y agoI just do it the one way, get the error that the destination already exists, then swap them.
- skzo 7y agoMe too, I was starting to think I was the crazy one after reading the other comments :)
- hanspeter 7y agoI 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.
- account42 7y agoExcept if b is a directory, then ln -s a b will create a symlink at b/a which points to a.
- taftster 7y agoYup, 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).
- autoexec 7y agoand now I've just memorized it myself. Thanks!
- vehementi 7y agoSounds like you're making bold assumptions about people's beliefs about whether the extra argument would go before or after the existing argument :)
- anilakar 7y agoI 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.
- nikconwell 7y agoA 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.