Linux Tip – When you forget to use sudo

New tutorial added to HowtoMatrix database.
Linux Tip – When you forget to use sudo

This happens a lot to me, I usually forget to start a command with sudo, and therefore I had to run it again.
<!–break–>
If you run into this problem run:

sudo !!

And the last command run, will be run again but this time with the command sudo in front of it.

i.e.

[user@myhost ~]$ /etc/rc.d/sshd restart
:: Stopping Secure Shell Daemon                                          [FAIL]
:: Starting Secure Shell Daemon                                          [FAIL]
[user@myhost ~]$ sudo !!
sudo /etc/rc.d/sshd restart
Password:
:: Stopping Secure Shell Daemon                                          [DONE]
:: Starting Secure Shell Daemon                                          [DONE]

In the example above, I entered the command without sudo command and ssh daemon failed to restart. After that, I just entered the command sudo !! and it asked for my password, and this time worked.


Link to the original site

Comments are closed.