4 ms·
I never understood the utility of history substitution (I think this is what it's called). Why not just ctrl-r to see the actual command? Also, `sudo !!` thingy
by demosito666 5y ago
I never understood the utility of history substitution (I think this is what it's called). Why not just ctrl-r to see the actual command? Also, `sudo !!` thingy that is (was?) persistent in the internets for some reason, is probably the dumbest thing out there.
- garmaine 5y ago“alias ffs=sudo !!” Is cute though.
- deleted 5y ago[deleted]
- DarkWiiPlayer 5y ago`sudo !!` is just very useful, just as most other things you can do with history substitution. Ctrl-R has its own usefulness but it only does a fraction of what history substitution can do.
- abdusco 5y agoI like fish shell's approach: [Alt]+[E] prepends the command with `sudo`. So you hit arrow up to bring up the last command, then [Alt]+[E] to sudo-ify it.
- gruturo 5y ago`sudo !!` is perfectly alright. It references the very last command, which in all likelihood is right there on your screen, typed by you a few seconds ago, and you're aware of the context. $!(some number) instead is quite insane and much more likely to have unwanted effects due to (potential) lack of context. Don't conflate the two.
- kevincox 5y agoI never used !! and similar. However my CLI is set to keep the cursor at the front when pressing <Up> to go through history (for easy prefix searching) so I can just use `<Up>sudo ` to get the same result and I like seeing the full command before I run it.