Screen vs tmux
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.
Contents |
[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
- Multiplexing
- As terminal multiplexers, both Screen and tmux can manage multiple shell instances, or "windows," at the same time within a single session.
- Persistence
- 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.
- Vertical splitting
- GNU screen has it only as a patch and has not been added to an official source code. The patch is also added in Debian and Ubuntu.
- 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 toscreen -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.
- Synchronize-panes
- 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.