Sharpening Tools with TMUX

Wed, Apr 18, 2012

A little over a year ago I switched to vim as my editor
of choice, and at the same time started using tmux
to manage a split pane terminal, but I spent so much time getting up to speed with vim
that I never really made much of an effort to embrace tmux - I learnt the shortcut
key to split the window and that was about it - good enough for a while, but not
exactly a power user!

Recently, the Pragmatic Programmers published an ebook by Brian Hogan tmux - productive mouse free development
that made me revisit this tool and see what else I could get out of it - and boy, am I
glad I did - tmux is a really useful tool, and Brian’s book covers it in an
excellent, easy to read, and comprehensive format that covers the following areas:

Learning The Basics

Configuring tmux

Scripting Customized tmux Environments

Working With Text and Buffers

Pair Programming with tmux

Workflows

Working my way through the book was a breeze. Its well written, well organized, and
doesn’t waste any space - except maybe the pair programming chapter - which is not
really my cup-of-tea. :-)

I now find myself jumping around panes and windows with ease and able to setup
environments that really suit the task at hand. For example, as I write this article
I have four windows in a TMUX session:

my VIM editor

a multi-pane console

a running web server

a tailing logfile

Example tmux window and pane configuration

The 4 ‘tabs’ at the bottom allow me to instantly see which hotkey (prefix-1/2/3/4)
will take me to which window, the current window is highlighted in red and any
activity in any non-visible window will cause that windows name to highlight as
well. Thats a lot of information in that small TMUX footer.

One of my favorite discoveries is the ability to create tiny little tmux scripts
to startup sessions pre-configured with windows and split-panes suitable for my
current task.

For example, if I want a session for SSH’ing in to do some operations work on our
production live site, I can run a little script like this:

And bang! I instantly have a 3 pane window that has SSH’d into the various production host
machines. Then I can simply detach when I’m done, leaving it running to attach to when I come
back later on, even potentially, from a different machine.

I dont intent to give any kind of tmux tutorial here. I just wanted to highly recommend
you try out the tool and go buy this book.