Say no to tabs and yes to panes when developing

For today’s post in the Code Challenge series, I’m giving an intro on tmux. As a Developer Evangelist, showing code is the best way to get developers interested in how easy it is to integrate the SendGrid API. When you’re up in front of a couple of hundred devs and live coding, switching through multiple tabs is not a good look. I got into tmux because it lets you open multiple programs on the same window to see everything that’s happening.

Tmux has since become part of my workflow whenever coding any new python application. I can’t get away from Xcode when developing for iOS just yet.

Here is how a typical tmux session looks for me:

Get it now and follow along below!

Mac OSX:

brew install tmux

Ubuntu/Debian:

sudo add-apt-repository ppa:pi-rho/dev
sudo apt-get update
sudo apt-get install tmux

Commands I’ve found helpful

Tmux has a default binding set to ctrl-b, so for example if you want to split the screen with two sessions just type ctrl-b and %, in the future I will just type (ctrl-b + %).

Panes:

(ctrl-b + "): splits the window horizontally
(ctrl-b + arrow key): switches the active pane

Scrolling:

(ctrl-b + [): puts the pane in scroll mode so you can scroll up and down with your arrow keys.

Tmux general:

tmux list-commands

Tmux Sessions

These are useful to have for working on different applications that require different environments. I have a session called “Demo” which I use when doing live demos to developers. I have another session which I use for development.

tmux new -s session-name

Creates a new tmux session with the name you gave it.

tmux list-sessions

Lists available sessions.

(ctrl-b + d)

Detaches the session being currently used.

tmux attach -t session-name

Attaches to the session.

This post really just skims on what you can do with tmux. For more information on tmux commands visit: (https://wiki.archlinux.org/index.php/tmux) and also a tutorial on how to pair program with tmux visit: http://collectiveidea.com/blog/archives/2014/02/18/a-simple-pair-programming-setup-with-ssh-and-tmux/.

Check back into the SendGrid Blog every Monday, Wednesday, and Friday for the next few weeks to see what I’m working on! You can also visit my intro post that will have an updated list of everything I’ve written for my 15 Days of Code Challenge.



Meet Kunal, Developer Evangelist at-large for SendGrid and home-grown New Jersey hacker. He previously ran General Machines, which developed Deaftel - a phone service for the deaf that converts voice to text and text back into voice over a phone call. Since March 2013, Kunal has been working as a Developer Evangelist at SendGrid, helping enable developers to get the tools and resources they need to make awesome, creative stuff.