“sudo !!” will run your last command as sudo!

I’m always forgetting to run sudo when I need it, and then I’ll typically arrow up, hit command-a to move to the front of the previous command and then type “sudo “. Just last night I remembered someone mentioning this in a tutorial so I looked it up, and I’ll never forget it now!

if your last command should have been run as sudo but wasn’t, you can run “sudo !!” on the next line and it will ask for your password and then run the previous command under sudo. Easier!

Tell me what you think.

This site uses Akismet to reduce spam. Learn how your comment data is processed.