Use This Terminal Command When You Forget To Type Sudo

Use This Terminal Command When You Forget To Type Sudo
To sign up for our daily newsletter covering the latest news, hacks and reviews, head HERE. For a running feed of all our stories, follow us on Twitter HERE. Or you can bookmark the Lifehacker Australia homepage to visit whenever you need a fix.

Sometimes, when you’re working in the command line, you need to enter “sudo” to assume root privileges for a given task. You may not always remember, but one little trick can save you from retyping your last command with “sudo” prefixed to it.

Just type this:

sudo !!

This will initiate the previous command with sudo in front of it, and you’ll be immediately asked for your password. This saves you a good amount of frustration — at least if you make this mistake as often as I do.

For more awesome time-saving shortcuts, check out our guide.

Terminal 101: 5 Time-saving Tips and Tricks [MacLife]

Comments

Show more comments

Comments are closed.

Log in to comment on this story!