Simple Trick To Run Last Command As Sudo

You can often forget what you are not running as a super user, so if you type in a command that you can't run with your current set of privileges it will tell give you a permission denied response.

An alternative is to use the !! command to run the last command in the .bash_history. Use this with the sudo command to run the last command as a super user.

> command
Permission denied
 
> sudo !!

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
2 + 7 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.