10 July 2011

sudo the 2nd to last command with sudo !-2 via @linuxaria http://goo.gl/zoYSo

sudo !!
You wanted to give a command as root but you forgot to use sudo ? Don’t worry with this command you’ll use the history combined with sudo, the argument !! has the same meaning that !-1 , so this command runs your last command as root.

Obviously this could be used also as

sudo !-2

if you give another command after the one you want to run as root, but take care on which command are you running as root.

via linuxaria.com

No comments:

Post a Comment