Working with tmux

in   Technology   ,

At my workplace, my laptop is little more than a glorified mailbox and thin-client. All my development is done on a shared Linux cluster, due to the nature of the build environment needing special compilers and tools. Up until a few years ago, I was logging into a VNC session to keep my sessions active. As I started to telework more, I was annoyed by the slow refresh rates. That’s when I realized that, since all my work was done with console Vim and a console, if I could move to a console interface, I’d wind up with a much faster workflow.

So I started off with screen, which is a pretty common utility in most Linux systems these days. While it was useful to keep my sessions alive, it always felt like it was missing something. Soon, a colleague told me about tmux and how it was better than screen. What really drew me to tmux was the fact that I could use xterm-style mouse reporting and tmux would interpret the mouse clicks. Add that to immense configurability, and I had a winning combination, one that I use till this day.

My workplace started to move us to a more powerful cluster, but the nature of the environment meant that users could no longer use VNC, but had to use NX, which was effectively a GUI interface but with the user’s own login, instead of a potentially shared password. I had started working with a Macbook Pro by then, and the NX clients just didn’t work. Fortunately, I had SSH access to the clusters, and since I was already familiar with screen, it was relatively simple to switch over to tmux, which was available on the new cluster.

Soon, I began to customize my tmux configuration; which, if you look at my dotfiles repository, you can see the history; starting to use different key combinations and bindings. It was a time of tinkering and fiddling until I found a combination that worked for my workflow style, and I’ve stuck with it for a while now.

The one thing that I wanted (not needed, mind you) was the ability to move the status bar to the top of the window, to more or less emulate the multiple tabs that I would have had if I was using a graphical interface. While this feature was available in tmux 1.8, my workplace was using tmux 1.6, which was woefully behind. Combined with a lack of root access meant that I could not simply compile and run tmux, since it required at least the ncurses and libevent libraries to be present on the system. I found a method of building the libraries and tmux such that they could be installed in my home folder, and since my ~/bin is always in my PATH, it was a trivial matter to either copy the tmux binary there, or simply create a symbolic link to the compiled binary.

This gist describes a script which will download and install tmux without needing root access.