While googling for something completely different (which I cannot remember right now), I passed by what is probably the best Bash tip I ever read:
bash$ head -10 /etc/apache2/sites-available/default
(...)
bash$ ^10^20^
(...)
What happens in the second command is that the previous one is repeated, replacing “10” by “20”! How great is that?!







The $! reuses the last argument of the previous command.
Check out this book, it’s got all the tips you could want:
Bash-Z-Shell-Conquering-Command
the last line will remove the -s option and thus install zsh
OLD TIP IS OLD!!
Some comments I put at our Developers’ Weblog
Of course, mksh(1) can do it as well:What’s best, the modified commands are written into the history, not the modificator itself.
Some of the commentaries are rather clueless too, not $! but $_ is the last word of the last command, in this case:
Instead of “^-s” you would use “r -- -s=” (the two dashes are needed as the “r” built-in alias parses its arguments).http://samrowe.com/wordpress/advancing-in-the-bash-shell/ has that and more.
See this: http://successtheory.com/tips/zshtips.html