Sep 052010
 

Update: I have created a new github repository which contains all my various dotfiles. You can now find my latest tmux.conf at https://github.com/solj/dotfiles/blob/master/.tmux.conf

I recently made the switch from GNU Screen to tmux. It took some time to get used to it, but it has turned out to be a pleasant experience. I had heard things a few things about tmux before making the switch, but none of them really made me want to switch away from screen. My screenrc took me weeks of time to get “just right” and I didn’t want to lose all that time. It doesn’t look like much, but the hardstatus/caption lines are extremely cryptic and non-intuitive.

One of the issues I had with screen was that it didn’t come with vertical splits by default (I had to patch it in). Even then, once patched, it was almost unusable over the slightly slow network I was using at the time. The claim that tmux handled this better was intriguing. When I also read that tmux used way less memory, I had to try it out.

The first difference I noticed when trying tmux was that when I started it up, the default layout was actually reasonable (I still remember my cluelessness when I first starting using screen). It most definitely uses less RAM

$ tmux ls
0: 20 windows (created Fri Jul 16 19:21:20 2010) [157x50] (attached)

This was a tmux session with 20 windows. Here is the ps output

solj     16390  0.0  0.0  23668  1192 pts/0    S+   15:48   0:00 tmux attach -d

That’s approximately 23MB of RAM. Here is the number of windows in use for a screen session I have open on another machine

Num Name                                                                                                                                                Flags

0 bash                                                                                                                                                    $
1 bash                                                                                                                                                    $
2 bash                                                                                                                                                    $
3 bash                                                                                                                                                    $

..and here is that machine’s ps output

solj      3230  0.0  0.0  24888   348 pts/1    S+   Aug27   0:00 screen -U

That’s approximately 24 MB of RAM which is slightly higher than the tmux session with 20 windows.

I decided to attempt to get my tmux sessions looking similar to my screen sessions. This turned out to be surprisingly easy after reading through the tmux man page. As opposed to the weeks it took me to get my screenrc just right, modifying my tmux.conf with the same options only took about half a day. Not only that, there are subtle improvements made possible by using tmux (such as highlighting the current window and the upcoming window-status-alert options) which improve the visibility of my session.

One issue I did come across was that I was trying to use the #(date) syntax to set the date in my tmux status line, however, this caused my session to become unresponsive after spawning off too many processes. After reading the man page, I realized this was unnecessary as it clearly states

string will be passed through strftime(3) before being used

I am now a happy tmux user and cannot see myself ever switching back to something that is not at all actively developed and which is unable to meet my current needs.

 Posted by at 21:57

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*