Tmux vs Screen

Here are some reasons why I recommend Tmux over Screen. Some are personal preference, some are not. If you’re a screen user, I recommend giving Tmux a try and making up your own mind (I have another post on how to setup Tmux, it won’t take long!).

  • The status bar is much easier to configure & use. Tmux allows you to easily script different status bars for the current window, windows with activity, etc. You can set the left, center, and right status bars separately, and you can use a shell command that gets run at a configurable interval to set the status bar.
  • Any command you can run from inside tmux can be run from outside using the tmux shell command, making tmux highly scriptable and allowing very complex commands
  • Much more accurate automatic window renaming. While screen sets the title based on the first word of the command, and requires shell configuration to do even that in a shell window, tmuxkeeps track of what processes are actually running in each window, and updates the title accordingly. This way you get dynamic renaming with any shell and zero configuration. For example: Let’s say you’re running Z Shell; the window’s name would be “zsh”. Now let’s say you want to edit some configuration file, so you type sudo emacs /etc/somefile. While sudo is asking for your password, the window’s name will be “sudo”, but once you’ve done that and sudo launches emacs, the title will be “emacs”. When you’re all done and you exit emacs, the title will change back to “zsh”. This is pretty useful for keeping track of windows, and it can also be especially useful in specific situations, like if you have some long-running process in another window that occasionally prompts you for input using dialog; the window name would change to “dialog” when that happened, so you would know you had to switch to that window and do something.
  • Far nicer session handling. You can do a lot more with sessions within tmux itself. You can easily switch, rename, etc. and you can move and share windows between sessions. It also has a different model, where each user has a server which controls his/her sessions and which the client connects to. The downside of this is that if the server crashes, you lose everything; I’ve never had the server crash on me, though.
  • Tmux is actively developed and is on GitHub, making it easier to contribute to (some may argue that screen is more mature, and doesn’t need to be actively developed, but I call BS, things change and I want my software to be ready to embrace that change)
  • Can do horizontal and vertical pane splits (I’ve heard screen cannot do vertical splits without a patch)

On the cons side:

  • Tmux does make it harder to copy & paste text then if you’d use a vanilla terminal (hopefully they fix that soon, it only broke in 2.1)
  • Resizing a pane with a lot of text can be very slow as tmux tries to reflow/rewrap all of the text
  • Developer has refused to add the ability to change certain default behaviors because he likes the behavior (maybe someone else will do a pull request though)
  • Not as mature & stable as screen
  • Some distros (e.g. CentOS 5) have trouble with Tmux, and I’ve been forced to overwrite TERM a few times to make things work (or copy up the appropriate term definition files)

So there you have it. If you’re still not sure, try both and make up your own mind!

1 Comment

  1. Amit says: Reply

    I am a Tmux user. However, a HUGE advantage to screen is that it’s coming out of the box on a lot of distros (or at least AMIs and images).

Leave a Reply