How I start working using Tmux


These days with micro-services running and multiple dependencies “starting” work can be tricky.
For example: Just running Gogobot means running rails c, rails s, foreman, spork, ./ and sometimes even more.

Just getting to work in the morning or after a restart, just remembering everything you need to run can be difficult, and that’s just the main project, not counting in the chef repo, all microservices and more, well, you get the drift.

Since I am working on many projects at any given time, I always have a file in the root of the directory called
This way, when I want to start working on a project I just cd ~/Code/gogo &&

This script is simple bash that automates Tmux.

Here’s an example:

tmux new-session -d -s gogobot
tmux split-window -t gogobot:1 -v
tmux split-window -t gogobot:1.2 -h
tmux rename-window main
tmux send-keys -t gogobot:1.1 "vim ." "Enter"
tmux send-keys -t gogobot:1.2 "bundle exec rails c" "Enter"
tmux send-keys -t gogobot:1.3 "./" "Enter"
tmux new-window -t gogobot:2
tmux select-window -t gogobot:2
tmux rename-window server
tmux send-keys -t gogobot:2 "rm -f log/development.log && rm -f log/test.log && bundle exec rails server thin" "Enter"
tmux new-window -t gogobot:3
tmux select-window -t gogobot:3
tmux rename-window foreman
tmux send-keys -t gogobot:3 "bundle exec foreman start" "Enter"
tmux new-window -t gogobot:4
tmux select-window -t gogobot:4
tmux rename-window spork
tmux send-keys -t gogobot:4 "bundle exec spork" "Enter"
tmux new-window -t gogobot:5
tmux select-window -t gogobot:5
tmux rename-window proxy
tmux send-keys -t gogobot:5 "cd ~/Code/go/src/ && sh" "Enter"
tmux select-window -t gogobot:1
tmux attach -t gogobot

Explaining the parts

Theres also send-keys which is pretty self explanatory, rename-window` and more.

I encourage you to read tmux reference, there are a lot of very useful tricks in there.

Final thoughts

You can see here, it’s pretty easy to automate your workflow around the terminal, I wrote about it some more in My development workflow (vim+tmux+terminal+alfred) Awesomeness.
It’s worth investing in automating your workflow, invest the time sharpening your skills and making your tools work better around your workflow.