commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
this command also can run the last command as root
what's more, sudo !-2 can run the second last command as root , and so on
There are 5 alternatives - vote for the best!
Useful when you forget to use sudo for a command. "!!" grabs the last run command.
\$ which python
\$ ll `!!`
lrwxrwxrwx 1 root root 9 2010-11-08 22:01 /usr/bin/python -> python2.6
Same as `sudo !!`. If you do not have permission to be sudo or sudo does not installed on your system, you can use this.
I often forget to type sudo before a command that needs it. This is the quickest way to rerun the command prefixed by sudo.
If you can do better, submit your command here.
You must be signed in to comment.