Tuesday, July 21, 2015

Tmuxing with Tmuxinator


So, Here is what’s happened, I was doing some testing with driver for #top_secrete project. So each time to test my driver, I have to go through following steps,

- ssh to target platform (tab0), run vim to edit code
- ssh to target platform (tab1), cd to source dir
- source environment
- build/install
- ssh to target (tab2), cd to log dir and start ldmesg script to continuously monitor dmesg logs
- ssh to target (tab3), cd to test dir and start test (server)
- ssh to target (tab3), cd to test dir and start test (client).

aahh, lots of steps and if driver crashes during testing (and that's what happens most of the times), I have to repeat this whole process again. Above described (steps) stuff is mostly unproductive. So how to avoid it??

So here comes tmux,

Tmux (terminal multiplexer) allows you to switch between multiple programs in single terminal. Its similar to screen.

Getting started resources for tmux :

So if I login in to target system over SSH in one terminal and start tmux, I can create multiple tabs inside single terminal using tmux to run multiple programs. This solves partial problem i.e. multiple SSH logins, but sill I have to do lots of stuff manually after creating multiple tabs using tmux. I needed further automation in the process...

After doing some googling I came across tool called tmuxinator.
It does exactly what's needed. Tmuxinator is awesome tool that allows you to configure tmux session i.e. how many TTYs (tabs) to start with, executing some commands on start, splitting window, base/root directory for each tabs can be configured separately, cool right!

Getting started resources for tmuxinator:

So tmuxinator automates most of the steps above, it launches tmux, creates multiple tabs, source env, changes dir to specific directory and additionally we can maintain multiple project settings/profiles much easily and what it needs is simple configuration file.

(will update more soon!)


Post a Comment