Screen vs tmux

From WikiVS, the open comparison website
Jump to: navigation, search

Both GNU Screen and tmux are terminal multiplexers designed for Unix-like platforms. In a sense, they may be thought of as window managers for a text console instead of the X Window System. Screen is easily the best-known terminal multiplexer, and because of this it tends to be the standard against which others are measured.


[edit] Licensing

As a GNU project, Screen is distributed under the terms of the GPL, while tmux is distributed under the terms of the BSD license.

[edit] Features

As terminal multiplexers, both Screen and tmux can manage multiple shell instances, or "windows," at the same time within a single session.
Both GNU Screen and tmux allow the user to detach and reattach terminal sessions, leaving any shells and their subprocesses managed by the multiplexer while detached.
Shared Sessions
More than one user at a time can simultaneously connect to the same session in either Screen or tmux.

[edit] tmux only

The following features are specific to tmux and not shared by GNU Screen.

Client/Server System
When the first tmux session is created (equivalent to screen -d -m), a server instance is started automatically, and the session runs as a client for that server. Further sessions operate as clients, connecting to the same server instance (equivalent to screen -x). The user can enter commands at any client to control the server instance, the current session, or any other client of the same server instance.
tmux can duplicate input to any pane to all other panes in the same window (not available for panes in special mode e.g. copy-mode). It provides you clusterssh like function to simultaneous input to all of the terms all at the same time.

ctrl-b :set-window-option synchronize-panes on|off

Screen can do this as well by using the following command:

:at \# stuff "command"

[edit] screen only

The following features are specific to GNU Screen and not shared by tmux.

zmodem transfers
In GNU Screen, you can enable zmodem transfers, so that even if all you have is a serial terminal connection, you can still transfer files (Ctrl+a :zmodem catch<ENTER> followed by typing sz <filename> on the remote end.) Tmux does not support this feature.
attaching to a serial tty
In GNU Screen, you can connect to a serial device (screen -r /dev/ttyS0 115200). Tmux does not support this feature.
Logging (outdated)
In GNU Screen, you can set up logging for a detached session from within screen (Ctrl+a H). Therefore you don't have to think about redirecting output to files all the time. For example, you start some long remote compilation process and suddenly you have to disconnect, but still want to have the build log. In screen you just press [<C-a> H] combination and detach, the output is being logged. This was not the case with tmux, though page scrolling and separate utilities such as script [1] could be used to provide access to such output. Tmux has now the pipe output function, by which all the output in selected windows is logged to selected files.

tmux now supports logging by "pipe-pane" option. $ tmux pipe-pane -o -t session_index:window_index.pane_index 'cat >> ~/output.window_index-pane_index.txt'

[edit] Interface

Both Screen and tmux use a command prefix whose default value interferes with a command character in most shells for moving the cursor (screen: Ctrl-A, the control character for moving to the beginning of the line without deleting; tmux: Ctrl-B, the control character for moving back one character without deleting). In case of a need to have standard shell behavior for Ctrl-A (in the case of Screen) or Ctrl-B (in the case of tmux), both applications can be configured to use a different command prefix. They both also provide a default command keybinding that can be used to send the requisite control character to whatever application the session contains -- "Ctrl-A A" in GNU Screen and "Ctrl-B Ctrl-B" in tmux.

[edit] Performance

Tmux was created to provide a simple, modern, lightweight, BSD-licensed alternative to GNU Screen. In general, the design goals for tmux ensure it is a relatively fast and lightweight application. The client/server architecture also ensures that increases of resource usage for multiple sessions are minimized.

[edit] Searchability

Web searches for Screen can be very difficult, because of the way the word "screen" is used for many different purposes much more popularly known than the terminal multiplexer. Even in a technical, computer related context, a much more popular use of the word refers to the display, as in the case of the screen of a desktop computer's flat panel monitor. Using the term "GNU Screen" in a web search can mitigate this problem, though it is not a perfect solution and may exclude many useful results that do not couple the word "screen" with GNU. Additional problems may arise as the most popular search engines have started deprecating the availability of features allowing users to restrict results to those that include specific terms, such as where Google has stopped honoring the "+" operator (the same effect can be achieved by quoting a word instead of prepending it with '+').

By contrast, the name of tmux is a far more unique term that tends to return useful information in the top results of popular search engines.

See Also the Following Articles

Personal tools