8
2
Frequently in Terminal (though I fully expect any answer will work in bash and most others), I type some command, and then get some sort of permission error due to missing sudo
.
Okay, so press 'up', hold/hammer 'left', type sudo
and hit 'enter'.
It's annoying. More so the longer the command was.
Note that missing sudo
is worst case; a typo nearer the beginning than end is similarly annoying.
What I would like, is a way to perform a sort of 'up and home' keystroke. Actually, perhaps those two strokes will do it - but my Macbook keyboard doesn't have Home, so I cannot try.
Bonus points for a way to insert sudo
and hit 'enter' auto-magically too, say by CMD+Shift+S.
Can this be done, or am I dreaming?
1I can't remember whether it's Ctrl+A or Cmd+A, but this shortcut is what I usually use when I used to work on OS X. Note that Ctrl+A gets you to the start of the command like "Home" button and Ctrl+E gets you to the end of the command like "End" button. I'm usually hesitant to use
!!
especially in combination with sudo, in case it turns out that the previous command isn't what I thought it ought to be. – Lie Ryan – 2014-07-04T02:19:35.0031CTRL+A is right for Mac OS X, I use it all the time. – Octavia Togami – 2014-07-04T15:03:42.070
@KenzieTogami Thanks for the confirmation I update the answer. – Hastur – 2014-07-04T15:44:22.063