Simple Trick To Run Last Command As Sudo

10th April 2008 - 1 minute read time

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.

  1. > command
  2. Permission denied
  4. > sudo !!

Add new comment

The content of this field is kept private and will not be shown publicly.