Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

sudo !!

Instant favorite



I often alias `sudo` to `fucking` to help vent my frustrations

    $ rm -rf somedir
    rm: somedir/: Permission denied
    $ fucking !!


I have been known to use sudo when it is not appropriate to use the f-word ;)


Along the lines of magic shell variables, there's also '!$', which selects the last argument of the previous command. Often I'm looking at different aspects of the same file:

    $ file foo
    $ ls -lh !$
    $ vim !$


I don't find this one useful. [up-arrow] automatically inserts the last command, which gives a generic mechanism to correct the command and it requires no more typing than !!: [up-arrow][control-a]sudo [enter]


moving your hand over to arrow keys is why I would use the sudo !! version.


[control-p] then ;)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: