207

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.

7
  • 11
    Also discussed at superuser.com/questions/236158/tmux-vs-screen Jun 2, 2011 at 20:32
  • 7
    As you can see from the good answers below, they are not opinion-based. Feb 15, 2017 at 14:45
  • @reinierpost - it seems many people here are too quick to close questions as "primarily opinion-based". However, we can vote to reopen.
    – MountainX
    Oct 1, 2018 at 1:32
  • 1
    Although this question is a comparison question, I think the pro and contra arguments are enough objective and thus the opinionatedness close reason is not okay here. You can check the linked SU question, the answers are pretty okay.
    – peterh
    Oct 1, 2018 at 2:24
  • 1
    @AjayBrahmakshatriya Obviously "this is bloat"-like answers are opinions. But a list, that "X can ..., ... and .., while Y can ... and ..." are objective. I think the "this is bloat" could be edited out from that answer (considering its score, I did not do it, but I also did not vote them).
    – peterh
    Nov 1, 2019 at 19:21

10 Answers 10

133

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.
4
  • 4
    damn... now I want to try tmux... just because screen didn't work for me due ot lack of vi keybindings. Aug 17, 2010 at 20:43
  • 1
    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, 2011 at 19:27
  • You can define arbitrary key bindings. See: openbsd.org/cgi-bin/…
    – nisc
    Dec 27, 2011 at 20:46
  • 1
    When they speak about implementing, they should finally solve the stupid bug with <C-Left> in vim in tmux.
    – yo'
    Feb 19, 2014 at 10:17
51

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.

4
  • 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, 2011 at 10:10
  • 12
    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, 2012 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, 2012 at 14:06
  • @Cos This was added "FROM 1.0 TO 1.1, 05 November 2009". @jrwren The command can be shorted tmux new -t 0 .
    – user285259
    Dec 11, 2017 at 0:19
25

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 https://tmux.github.io/

0
19

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.

3
  • Your answer would be more useful if you summarized the features of byobu, like this answers with its list of features. Apr 21, 2011 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, 2011 at 18:58
  • 2
    byobu appears to actually support tmux as well, at least in more recent versions.
    – Darael
    Jun 16, 2012 at 15:32
17

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.

2
  • 11
    you can split vertically in screen as well. mmm... at lest it works in default Ubuntu 10.10 screen install.
    – Stann
    Feb 6, 2011 at 22:58
  • 4
    @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. Mar 27, 2011 at 14:05
12

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'.

12

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.

8

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"
2
  • 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, 2013 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. Jan 22, 2013 at 21:08
8

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.

4
  • 2
    I haven't had scrolling with screen like ... ever? :/
    – mike3996
    Mar 15, 2011 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. Mar 27, 2011 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. Mar 28, 2011 at 18:54
  • possibly a patch... ours are all 5.5 cent systems Mar 29, 2011 at 9:36
6

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

Not the answer you're looking for? Browse other questions tagged .