Re:Devops/Sysadmin Cheatsheet
by CJefferson on Friday January 11, 2013 @12:54PM
(#5043925)
So, what's wrong with sudo !! then?
[ Parent
| on HN ]
It's too easy to have a sticky key and type sudo !1 by accident. As a rule, not a good idea to do sudo from history without examining it first. So do up arrow or CTRL-P and the edit the command.
It re-executes your previous command -- this time with root privilege.
If and only if you meant to do that, you're fine.
Why else would you type it in? I can't imagine many people saying "hm, that command I didn't intend to run didn't work. Maybe I should run it as root instead."
Hopefully if you're in a NOPASSWD user/group, you know what root can do if you're careless; if you're not, there's yet another point where you'd have go out of your way to do damage with this shorthand.