Sometimes we just forget that we need to specify elevated privileges on our Ubuntu machines. I do it all the time, particularly when I’m setting up a new machine.
Thankfully there’s a shortcut for those of us who are forgetful. If I want to restart the box I can use a command like:
shutdown -r now
But of course that command requires elevated privileges:
shutdown: Need to be root
With the fantastic !! argument for sudo you can repeat your last terminal command:
sudo !!
Now you can quickly and efficiently re-run that last command you forgot to sudo!!