News for hackers. Stuff that matters.
Re:Devops/Sysadmin Cheatsheet by jiggy2011 on Friday January 11, 2013 @12:17PM (#5043666)
I suppose if you type it at any random point it might be. It's useful more when typed something that you forgot to sudo.
Re:Devops/Sysadmin Cheatsheet by darkarmani on Friday January 11, 2013 @01:01PM (#5043973)
If you are running sudo, the long-term payoff is probably higher if you never use sudo !!. The very small chance of a huge disaster is still a lot higher than up arrow. Unless you are on a laggy connection and up arrow delays and you push it twice and end up running the wrong command!

If you have lots of jitter and lag, i suggest using Mosh which I've found to be amazingly awesome when using it on Amtrak's spotty free wifi (3G uplink).

Re:Devops/Sysadmin Cheatsheet by ineedtosleep on Friday January 11, 2013 @01:30PM (#5044158)
I've never had any incidents with `sudo !!`, however, I should point out that zsh (maybe other shells as well) replaces the `!!` with the full command and requires another press of Enter.

    $ rm -rf /root
    rm: cannot remove `root': Permission denied
    $ sudo !!  # Does not run this, but returns the line below.
    $ sudo rm -rf /root  # Then you say, "Wait I dont want to do this."
Re:Devops/Sysadmin Cheatsheet by chc on Friday January 11, 2013 @01:39PM (#5044211)
Interesting. Bash on my OS X box shows the command you're running, but doesn't give you a chance to cancel it. It looks like this:

  $ rm -rf /root
  rm: cannot remove `root': Permission denied
  $ sudo !!
  sudo rm -rf /root
  # /root is now kaput
Re:Devops/Sysadmin Cheatsheet by chc on Friday January 11, 2013 @01:36PM (#5044195)
I think it's meant for when you run a command normally, but then realize you should have sudoed (sudid?) it. Though in that situation, I would still be inclined to do "↑ esc a sudo ". It's not a lot more work, but it is a lot less uncertain.
Re:Devops/Sysadmin Cheatsheet by aidos on Friday January 11, 2013 @04:08PM (#5045030)
Indeed. I find ctrl-p ctrl-a is faster than going to the cursors.
Re:Devops/Sysadmin Cheatsheet by chc on Friday January 11, 2013 @05:05PM (#5045341)
Whoops, thanks. Should have been ctrl-a, but spelling out muscle memory is, like, hard.
Re:Devops/Sysadmin Cheatsheet by sp332 on Friday January 11, 2013 @02:33PM (#5044494)
Shoulda sudone it!