Your Terminal is Your Friend

I wanted to share my thoughts on how I currently use my terminal emulator to stay productive.

My progression through my career has seen quite a few stages of productivity gains, a lot of them based on recognizing recurring inefficiencies in my terminal workflow, seeing what is out there to correct them, and in some cases writing software to fix these workflow issues. Just as in the power of investing, and compound interest; I believe there is a certain analogous power in always searching for top-market tools, investing your time in them (to learn, to use, to develop), and reaping exponential time-saving rewards. If something in your workflow feels like assembly line work, that may be a good indicator that your time is being spent on something that your computer could do much better, and much faster. You deserve to be left free to be creative, and focused; while your computer does that kinds of tasks that computers do best.

Get a good terminal emulator with multiplexing support. I currently use iTerm2 ( There are other options, this is just what I use. If you are using Windows, look into Cgywin. Gow is another alternative, although I don’t have exposure to it. Pick a toy, and learn it well.

iTerm has a number of features I like. I regularly use horizontal, and vertical split panes. It saves time from creating seperate windows. Practice the keyboard shortcuts for these; eventually you will get your time payout without even thinking about it.

Ctrl+Option+Shift+H   –  New horizontal split shell

Ctrl+Option+Shift+V     – New vertical split shell

Yeah, I just had to go into my shell and create a split shell. It’s so muscle memory at this point, I couldn’t recite the keys otherwise.

Another feature I live and breathe by is terminal profiles. If you are like me, you may have multiple areas on disk you frequent; whether they be projects, specs, or whatever. I like to be able to do Ctrl+Option+Shift+H, and choose a profile that sets up a new horizontal split shell with Java 8 on path, and ruby 2.3 set from rvm. Instantly. You can define your profiles to do so much more than just start at a path. If you can think of it, it can probably be done. I have several projects I work on, sometimes with different environment configuration that is required (like my example above); I find profiles extremely useful for this.

Nurture your shell profile

These things above are quick, and with a little bit of time and practice; will save you tons of time. Another common thing you might run into is running the same command over, and over, and over. Being lazy in this regard is a virtue; Any time you spend typing, is likely time you aren’t spending thinking. If you find this happening, nurture your shell profile; Add an alias. For example, I have several for common git commands I use every day.

gfp – git fetch -p

gco – git checkout

gbr – git branch -r

It’s simple, but it’s effective. Create functions in your profile (~/.bash_profile for bash users). I have a functions that call several smaller commands. I have functions that display my current git branch before the cursor line. e.g

function git_branch {
    git_branch=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
    if [ -n "`git status 2> /dev/null | grep "# Untracked files:"`" ]; then
    if [ "`expr "$git_branch" : '.*'`" -gt "0" ]; then
        echo \($git_branch$untracked\)

PS1='\[`git_color`\]`git_branch` \[\e[0m\]$ '
PS2="> "

You probably have Puppet, Chef, or other configuration management solution provisioning your environments (right?); so lots of frequent, manual updates across many SSH shells may not be a super common occurrence; but say it needs to happen; there are a few great distributed shell agents to help you get your task done faster than manually applying, or inspecting each environment. Google has a great solution for this called their parallel distributed shell (pdsh). man(pdsh) has a good explanation of the various options. I choose to use Dancer Shell profiles to quickly dispatch commands to groups of servers. You can define flat files under ~/.dsh/group, where each line is the domain name of each server. Also note environment variables, PDSH_SSH_ARGS, and PDSH_SSH_ARGS_APPEND. These may be useful based on your circumstance.

Try defining an example group, “test”, under ~/.dsh/group/test. You should be able to dispatch commands in parallel by running pdsh -g test

The upside is you can dispatch commands to a large amount of servers at a time. The downside is that if you task requires you to visually parse information; it will prove to be difficult.

Another option to look into for quick split screening on iTerm is i2cssh. You can define YAML configuration (under ~/.i2cssh) such as

version: 2
broadcast: (true)
login: jbornemann
profile: default
sleep: 1
    columns: 2

then run, i2cssh -F -c example to initiate a 4 way split-pane TTY.


Keep searching for productivity gains! You will thank yourself! Cheers!