If you’re like me, you spend most of your time in the terminal. On OSX that means iTerm2 for me. I won’t go into details on how many orders of magnitude better iTerm2 is than the default Terminal app, because most likely you’re already familiar with it.

Update 2018, the following is not longer true, and personally I’ve switched back to stable releases of iTerm2. What you might not know is that what is considered the stable version of iTerm, is a bit like the stable version of Debian. It’s very conservatively updated, and most features take quite a bit of time to trickle down into a major release. So after I discovered that the Nightly builds are relatively stable I switched, and have not looked back.
Yes granted the updates keep rolling in, but as I’ll get to, using tmux for window arrangement means this doesn’t really bother me. So go get the nightly build now!

One of the best features of iTerm2 is the tmux integration. What it enables is a way for iTerm2 to communicate with tmux via tmux’ “Control Mode”. Basically you start an iTerm window and enter :
tmux -CC
which will open a new iTerm window linked with tmux. So any iTerm session operations (opening a new tab, a new window or a split) will be handed off to tmux. If you then were to quit iTerm, or close the window, you could easily get your complete window arrangement back by doing tmux -CC attach. This is indeed very handy.

So now we have pretty persistent window arrangements, which will give you the opportunity to over-indulge on tabs/splits/windows etc. Now we apply some order to the mess we inevitably will create.
iTerm has two cool features that will enable quick navigation of your sessions. The first one is badges. I’ve found that I like to set custom badges instead of relying on automatically set badges. So, first I set the badge options

printf "\e]1337;SetBadgeFormat=%s\a" $(echo -n "\(user.myBadge)" | base64)

and then define a bash function:

setbadge() { printf "\e]1337;SetUserVar=myBadge=%s\a" $(echo $1 | base64); }

Now we can easily set badges in tabs, by typing: setbadge BadgeName
iTerm2 Screenshot with badge The second feature that ties nicely into this is Session Search. Open with Cmd+Shift+O and you can quickly search and switch to the tab/window you like. There is also Tab Exposé Cmd+Alt+E but it’s slower.

There are tons of other ways iTerm2 can improve your everyday terminal life, I just found this to be a very handy addition to my toolbox.