Use This Terminal Command When You Forget To Type Sudo

Use This Terminal Command When You Forget To Type Sudo

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]


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments


4 responses to “Use This Terminal Command When You Forget To Type Sudo”