Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Browsing through questions I found about tmux (I normally used GNU Screen). My question is what are pros and cons of each of them. Especially I couldn't find much about tmux.

share|improve this question
7  
Also discussed at superuser.com/questions/236158/tmux-vs-screen –  Lloyd Dewolf Jun 2 '11 at 20:32

10 Answers 10

up vote 74 down vote accepted

From their website:

  • How is tmux different from GNU screen? What else does it offer?

tmux offers several advantages over screen:

  • a clearly-defined client-server model: windows are independent entities which may be attached simultaneously to multiple sessions and viewed from multiple clients (terminals), as well as moved freely between sessions within the same tmux server;
  • a consistent, well-documented command interface, with the same syntax whether used interactively, as a key binding, or from the shell;
  • easily scriptable from the shell;
  • multiple paste buffers;
  • choice of vi or emacs key layouts;
  • an option to limit the window size;
  • a more usable status line syntax, with the ability to display the first line of output of a specific command;
  • a cleaner, modern, easily extended, BSD-licensed codebase.

There are still a few features screen includes that tmux omits:

  • builtin serial and telnet support; this is bloat and is unlikely to be added to tmux;
  • wider platform support, for example IRIX and HP-UX, and for odd terminals.
share|improve this answer
1  
Thanks. I've browse the website and I couldn't find it. –  Maciej Piechotka Aug 17 '10 at 19:48
2  
damn... now I want to try tmux... just because screen didn't work for me due ot lack of vi keybindings. –  xenoterracide Aug 17 '10 at 20:43
    
Does vi or emacs keybindings just mean tmux comes with a two convenient sets of defaults? It is possible to completely reconfigure screen's keybindings with its rc file. –  jw013 Dec 27 '11 at 19:27
    
You can define arbitrary key bindings. See: openbsd.org/cgi-bin/… –  nisc Dec 27 '11 at 20:46
    
When they speak about implementing, they should finally solve the stupid bug with <C-Left> in vim in tmux. –  tohecz Feb 19 at 10:17

One difference is in how the two act when multiple terminals are attached to a single session.

With screen, each attached terminal's view is independent of the others. With tmux, all attached terminals see the same thing.

Say you have two terminals attached to a single tmux session. If you type ^B 1 into one terminal, the other terminal also switches to window 1.

When you have two terminals attached to a single screen session, and you type ^A 1 into one, it has no effect on the other terminal.

This is based on my experience with tmux 1.2; I see 1.3 is out but I didn't notice anything in the changelog about this behavior changing.

If you like the screen behavior and want it in tmux:

If your original tmux session is called 0 (the default), then you can do tmux new-session -t 0) to start up a new independent session connected to the same set of windows, which can then have its own view.

share|improve this answer
1  
This is an interesting distinction. I'm sure each of these has advantages, for different use cases. (tmux advantage: two people attached to same tmux session e.g. for remote pair programming would always see the same thing; screen advantage: one person attached to the same screen from two places for two different purposes can have two different views, even simultaneously (with, say, side-by-side (OS/windowmanager-level) windows).) –  lindes Feb 22 '11 at 10:10
10  
if your original tmux session is called "0" (the default), then you can do "tmux new-session -t 0") to start up a new independent session connected to the same set of windows, which can then have its own view. I'm pretty sure this worked back in 1.2/1.3, but I can't remember offhand. –  Cos Jan 26 '12 at 21:05
    
@cos this is exactly the tip for which I was looking. Thank you so much. I wish I could up vote you twice :) I'll start reattaching with 'tmux new-session -t 0' every time now. –  jrwren Apr 2 '12 at 14:06

tmux is fairly new compared with GNU screen. Advantages / Disadvantages is a tough question, as both programs solve approximately the same problem. tmux is BSD licensed while screen is GNU GPL. This matters to some people.

screen is more represented (on Linux) at the moment, that is, you are more likely to find it on a given linux box than tmux. tmux is however more represented on OpenBSD as it is included as part of the base install.

Both programs allow you to do about the same thing, though the state of things is a bit more complex than that. Switching between the two is not overly complicated, as much of screens functionality has also found its way into tmux, though if you are a power user of either one, you will likely find some frustrations when switching to the other.

As with any program, it really depends on your needs, and which you are more comfortable with. Give them both a try and see which you play nicely with.

For more info on tmux see http://tmux.sourceforge.net.

share|improve this answer

The biggest difference in my use has been that in Gnu Screen you can only split frames horizontally, whereas in Tmux you can split both horizontally and vertically. This is kind of a moving target, though as I here tell that vertical split is making it's way into screen.

Other then that, things are about flat.

share|improve this answer
8  
you can split vertically in screen as well. mmm... at lest it works in default Ubuntu 10.10 screen install. –  Stann Feb 6 '11 at 22:58
3  
@andre there's been a long standing patch for vertical split in screen... that was never incorporated into upstream... but I'm sure many distro's applied it. –  xenoterracide Mar 27 '11 at 14:05

I thought I would just mention about the byobu wrapper that is available for screen that makes it so much better right out of the box. I don't know if something like this is available for tmux, but byobu made my .screenrc only a handful of lines. Check out this quick article about byobu and screenshots. The project page for byobu describes the name originating from a Japanese term for decorative, multi-panel screens that serve as folding room dividers. Also, just running it doesn't harm your screen settings, so you can safely try it. Once you start the session with byobu you can freely reconnect to it using screen and still not loose any customizations done by byobu (so use it only for the initial invocation). The two main advantages of it are:

  • Starts screen with a couple of status bars with useful information
  • Provides many keybindings to access screen's functionality easier

I am not using the keybindings part, but definitely find the status bars useful.

Also you might find Screen Vs tmux link useful. I think most of it is already mentioned by existing answers.

share|improve this answer
    
Your answer would be more useful if you summarized the features of byobu, like this answers with its list of features. –  Gilles Apr 21 '11 at 7:24
    
OK, I added more information on byobu, but it is as simple as running the command and finding it for yourself (it is menu driven), since it doesn't messup your existing screen settings. And I made my answer a community wiki, so feel free to edit it. –  haridsv Apr 21 '11 at 18:58
    
byobu appears to actually support tmux as well, at least in more recent versions. –  Darael Jun 16 '12 at 15:32

Drench raises an interesting point - the default behavior of connecting twice to the same session is different in tmux. However, if you want to attach twice and have an independent view of the windows in that session - start tmux with

tmux new-session -t <session name>

That will create a new session for you, and attach the windows from the already existing session. If you didn't name your first session, you can add one with 'rename-session'.

share|improve this answer

tmux is newer and several more features.

I have found that good use depends on good setup.

I use vi(vim) for editing (ruby on rails) and there's a few setup things to make that work well.

Here's my ~/.tmux.conf file with lot of helpful setting:

bind r source-file ~/.tmux.conf \; display "Reloaded!"  # Reload with ctrl-r
set -g prefix C-a         # prefix from ctrl-b to ctrl-a
unbind C-b                # allow ctrl-b for other things
set -sg escape-time 1     # quicker responses
bind C-a send-prefix      # Pass on ctrl-a for other apps
set -g base-index 1        # Numbering of windows
setw -g pane-base-index 1  # Numbering of Panes
bind \ split-window -h    # Split panes horizontal
bind - split-window -v    # Split panes vertically
bind h select-pane -L     # Switch to Pane Left
bind j select-pane -D     # Switch to Pane Down
bind k select-pane -U     # Switch to Pane Up
bind l select-pane -R     # Switch to Pane Right
bind -r C-h select-window -t :-  # Quick Pane Selection
bind -r C-l select-window -t :+  # Quick Pane Selection
bind -r H resize-pane -L 5       # Switch to Pane Left
bind -r J resize-pane -D 5       # Switch to Pane Down
bind -r K resize-pane -U 5       # Switch to Pane Up
bind -r L resize-pane -R 5       # Switch to Pane Right
setw -g mode-mouse off           # Mouse Off
set -g mouse-select-pane off     # Mouse Off  
set -g mouse-resize-pane off     # Mouse Off
set -g mouse-select-window off   # Mouse Off
setw -g monitor-activity on      # Activity Alerts
set -g visual-activity on
set -g status-fg white           # Status line Colors
set -g status-bg black
setw -g window-status-fg cyan    # Window list color
setw -g window-status-bg default
setw -g window-status-attr dim
setw -g window-status-current-fg white     # Active Window Color
setw -g window-status-current-bg red
setw -g window-status-current-attr bright
set -g pane-border-fg green      # Pane colors
set -g pane-border-bg black 
set -g pane-active-border-fg white 
set -g pane-active-border-bg yellow
set -g message-fg white          # Command/Message Line.
set -g message-bg black
set -g message-attr bright
set -g status-left-length 40     # Status Line, left side
set -g status-left "#[fg=white]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-utf8 on            # Status Line, right side
set -g status-right "-------"
set -g status-interval 60        # frequency of status line updates
set -g status-justify centre     # center window list
setw -g mode-keys vi             # vi keys to move 
unbind v                         # Open panes in same directory as tmux-panes script
unbind n
bind v send-keys " ~/tmux-panes -h" C-m
bind n send-keys " ~/tmux-panes -v" C-m
unbind Up                        # Maximizing and Minimizing...
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
share|improve this answer
    
Tmux is newer, but 'several more features' implies it also has at least feature parity with screen which is not the case -- In addition to whats mentioned elsewhere, tmux's multi user support is severely lacking. No acls or status's, and just in general it shows the newness of tmux in that what you can do isnt very polished. –  semi Jan 22 '13 at 18:46
    
That's good to know. I've now been using it for a year and didn't notice any need for polish although a little hungarian might help. Notation that is. ok bad pun ;) Hadn't used screen before it so not noticing the issues mentioned. Would find it harder to switch to screen and lose the new features now. –  Michael Durrant Jan 22 '13 at 21:08

One big con for screen is that it is not actively developed. The bug pages have close to 200 unassigned items going back over 5 years.

tmux has some open issues as well, but far less, and is more actively supported.

share|improve this answer

I had troubles getting screen to support utf-8 and 256 colors but tmux worked out of the box.

share|improve this answer

I will take the liberty of adding one difference:

tmux is ncurses based while screen does not draw additional elements. If someone use terminal emulator that supports scrolling (s)he will get scrolling with screen but not with tmux (at least in default configuration). The same thing applies to searching and similar features.

share|improve this answer
2  
I haven't had scrolling with screen like ... ever? :/ –  progo Mar 15 '11 at 11:10
    
yeah my TE supports scrolling and screen breaks it... I have to scroll with screen. -1 does not appear to be accurate. –  xenoterracide Mar 27 '11 at 14:06
    
@xenoterracide: Hmm. You are partially right. Screen on some distros/systems (older Gentoo) does not break it while on some (new Ubuntu) it does. I have no idea why. –  Maciej Piechotka Mar 28 '11 at 18:54
    
possibly a patch... ours are all 5.5 cent systems –  xenoterracide Mar 29 '11 at 9:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.