Effective bash shorthand

Let me tell you how to maximize your productivity on the Bourne Again SHell while minimizing your effort. bash has a ton of tricks and shortcuts that allow you to command it with little effort, and I intend to show you the features that help me day in and day out.

Today I’m going to explain the use of features like history, brace and file expansion, and other tricks by example and give you references for later.

Master your history

Those who forget history are doomed to repeat it. This is arguably one of the best productivity enhancing features of any shell.

Use pushd and popd for faster CLI navigation

One of my favorite ways to save time on the command-line is to utilize the directory stack to jump between tasks. Today’s article will show you how to do this and provide some tips for effective use.

What is the directory stack?

Most Linux environments have a way for you to put paths on a stack (push) and then take them off in reverse order (pop). This is useful when you have more than one directory that you need to switch between frequently. Let’s take a look at how to do this.

Start using crontab for automation

I seem to preach a lot about automation for productivity, and with good reason. You should not have to perform mundane tasks repeatedly. Crontab is a fantastic tool for simply running exactly what you want at times you specify.

Fire up your terminal or Cygwin now.

crontab tutorial

Suppose I want to copy my personal wiki to my website every other hour between 8:30 and 18:30 on weekdays only. This only takes a couple minutes to setup with a bit of cron-fu.

I’m going to go ahead and use FTP to put my wiki where I want, so I wrote a quick bash script (backup_wiki.sh) for this purpose: