Various bash tricks
Feb. 28th, 2007 09:34 pmHappened across a few new super-cool bash tricks today. Here are my favourites:
magic-space- This causes bash to substitute C shell-type history escapes when you next type a space. Thus, something cryptic like "
ls -l !!:2*" changes to something readable like "ls -l foo bar" before you hit the return key. Seriously useful for preventing history goofs. M-.- Cycles through the last arguments on previous command lines. Very useful if you do stuff like "
ls -l foo" followed by "rm foo" a lot. M-o- Defined as "
\C-p\C-a\M-f", this goes back to the start of the previous history line, skips over the first word and inserts a space. Perfect for adding extra command line options to the last command.
I also thought the idea of replacing Up and Down with history searches sounded interesting, but I'm not sure how much of a overhead it imposes &mdash performance is already close to glacial on the vector nodes, so I don't really want to do anything that might make it worse. Maybe I'll try it out on my desktop box and see how I get on.