sudo
, instead of retyping the command you could use
# to run the last command in history with sudo sudo !! # or you could use if you prefer sudo !-1 # run the second to the last command in the history with sudo sudo !-22. To have an interactive shell as root:
sudo -i # or sudo su -3. when you use vim and forget to type sudo
:w !sudo tee %