Cool idea. For those systems where you don't have the option of adding a 3rd party tool, it's probably worth knowing some of the standard bash shortcuts. The easy to remember ones are: !^ - the first argument from the previous command !$ - the last argument from the previous command !* - all of the arguments from the previous command !! - the entire previous command For example: $ apt-get install foo # Crap $ sudo !!
Typo correction is useful too. ^foo^bar git brnch ^r^ra This works on all Unix machines
You can also just run a sed style substitution in most shells, e.g. '$ !!:s/before/after/' or '$ !!:gs/x/y/', which is safer IMO.