Increased Developer Productivity with Tmux, Part 3: Sessions
Understanding Tmux Sessions
In Part 2 I went over my
~/.tmux.conf file. In this installment, I take a peek at another core Tmux element, sessions.
Every time Tmux is launched anew it creates a new session. Under the covers, Tmux has a server component that the sessions attach to, a "Mother ship" as it were. It may be confusing at first to learn that Tmux does not launch in stand-alone fashion like say Vim does but the "client-server" design has its advantages. Let's explore Tmux sessions.
- To list of all of my current sessions I type
- If the
tmuxcommand with no arguments is executed a new unnamed session will be created.
- To reattach that session issue a:
- Next, I delete or "kill" this session.
- Let's run through making a named session.
- Finally, if you want to kill and restart the Tmux "server" issue a:
$ tmux attach -t 22
You want to be mindful of how many Tmux sessions you have open as it may lead to a decrease in performance. You're like "no duh" but sometimes because a new session and Tmux itself being command-line centric (not a GUI app like Photoshop) we let it fly under the radar when trying to troubleshoot a poorly functioning development machine. Moreover, if you can't open new windows or panes in a current working session it is likely that you need to kill a session or two.
$ tmux kill-server
That concludes installment 3. Sessions
Understanding sessions is fundamental to wielding the Tmux "sword". In this article and screencast, I reiterate exactly how I use sessions, which will cover the basics. There are more advanced topics that I would have you made aware off, primarily multiple users sharing sessions and running a session within a session.
If you like this article and screencast go to the dedicated page for this series at http://minimul.com/teaches/tmux.
- Pushed on 06/02/2014 by Christian