We often see an error when executing a command that requires the root user permission. For example, installing a npm package as global probably requires
$ npm install -g package-name
In order to sudo the previous command, usually we press the Arrow key, append
sudo to the beginning of the command and run it again.
It turns out that there is an easier, shorter command:
$ sudo !!
!! references the last command.