3 ms·
I wish the order of the arguments of ln were easier to get right. One time I did an ln --force with the arguments in the wrong order and ended up ruining all th
by ufo 5y ago
I wish the order of the arguments of ln were easier to get right. One time I did an ln --force with the arguments in the wrong order and ended up ruining all the files. Had to restore from backup.
- superluserdo 5y agoI always used to think ln's argument order was totally counterintuitive too. Then I realised that they might have done it that way to account for the case where you only give one argument. If you use `ln <targetpath>` without a link path, it will make a link in the current directory with the same name as the target file. This way, in both cases, the target is the first argument.
- pkrumins 5y agoThe order of LN arguments is #1 gotcha in my opinion when working in the shell. I was confusing the order of LN arguments for years until I read a pro tip that they are the same order as CP arguments. cp file1 file2 Creates file2 that is a copy of file1. And now ln -s file1 file2 Creates file2 that links to file1. No more confusion.
- foodevl 5y agoMaybe find a mnemonic? In college, while I paused to remember the order, a friend blurted out "fake things last", and that phrase has stuck with me. I always hesitate a second but never get it wrong now.