Although the up/down arrow are nice to move through commands in a Bash shell, searching takes the command history to a whole new level.

To start a search within Bash, enter Control-R, the prompt will then change to look as follows:


As you type, matches will be shown, with the cursor directly on the character where the match occurs.

- Hit enter to run the command as is
- Hit Command-R to find more matches
- Type (or delete) characters to refine search
- Type left or right arrow key to edit command (before running)

I recently had to rename somewhere in the neighborhood of 100+ files as I was moving code from one platform to another. Obviously, I was looking for a quick solution, and what follows is the shell (Bash) script that I used to do the job:

Read more »