bash

Mastering the Command Line

Tab key on a standard Windows keyboard

Image via Wikipedia

If you use *nix, no doubt you’ve spent some time on the command line. Here are a few of the most helpful tricks you can use in the bash shell to really optimize your time, impress your friends, and make everyone else feel inferior… not to mention become more productive. People familar with the command line can usually work considerably faster (for most tasks) than you can through a gui. So be brave, embrace the keyboard and master the bash shell.

Bash heavily uses two keys, Ctrl and Meta. You’ll easily find the Ctrl key on your keyboard, but the Meta, not so much (unless you’re on a Sun system).. It’s also different for Mac vs PC. Point is commonly called cursor.

All tips taken from the very large man file (man bash), with my additional commentary. Please reference that file for more information.

Recursive Search and Replace Bash Script

I had a need to perform a search and replace operation on all files in a directory of files. Effectively I needed a recursive sed. I couldn’t find one and wrote this script. This is version .1, but worked for my needs, hopefully others find it useful. It is probably a smart practice to backup your set of files before running any batch operation on them. The script is released under the GPL2 License.

Bash Script Skeleton

I commonly write a quick bash script to solve certain problems. I found myself typing the same code over and over again. Looking for a better solution I googled for a bash script skeleton and found a good one at withouthat.org. I customized it a bit and updated it. Here is my version.