tmux is an awesome terminal multiplexer. I have been an Xmonad user about 4 years, and everytime I heard about tmux in the past I used to think that my window manager was powerful and I din’t need another terminal manager. But, tmux is much more than that.
If you spend a lot of time on your terminal, I urge you to take some time to learn tmux, you’ll be surprised by it. Anyway, the point of this post is to show you its scriptability.
I hacked together the following script from various sources online.
This script is to manage my workspace for Zammu(Zammu an awesome continuous delivery app that I am currently working on, Go check it out at https://zammu.in/). Zammu is a rails app, it is architected to use a bunch of microservices, so to start any meaningful work I need to fire up those agents too. Doing this manually is very tedious, with tmux I have one command to do it:
I just run tmz
and it does the following:
- Opens my editor with my TODO file in the first window.
- Opens a pry console in the second window.
- Creates a split pane in the second window with a bash terminal, also runs the git log command, git status command and launches a browser with my server’s url.
- Creates a third window with
rails server
in the first pane,sidekiq
in the second pane,foreman start
in the third pane which starts all the agents and aguard
agent for livereload in a tiny 2 line pane. - Finally it switches to the first window and puts me in my editor.
This has been saving me a lot of time, I hope you find it useful.
I have similar workspace setter uppers for my communication (mutt, rainbowstream, irssi) and other projects.
I just ran the command history | grep '2016-02-17' | wc
and it gave me 591 3066 23269
That is 591 commands in 3066 words and 23269 characters and that’s just the terminal.
Do yourself a favor and use tmux.
I have also created a short screencast for it, check it out.
1 |
|