News for hackers. Stuff that matters.
Re:Run last command as root by shubber on Friday December 17, 2010 @06:29PM (#2018309)
One of my favorite, under-known Bash tricks: Ctrl-O. "Enter current command, put next history item on command line."

It works like this: You're doing 3 things over and over again, but you need to see each step finished before you want to go on. Something like:

>wget buildserver/artifact.jar >java -j artifact.jar > result.txt >grep "Stupid bug" result.txt >vi config.xml >git commit -a; git push

Something like that. Having done it once, up-arrow into your history to the wget, hit "Ctrl-O" and it'll execute the wget, and now the java command is ready. You can just keep cycling through with Ctrl-O, since executing the command puts it in the end of your history. If you need to update the command, the fix is available for later. One of those "use it so that you remember, 'cause boy-howdy it's handy"

There are no comments on this comment yet.