Linux Guide/tmux
The "tmux" manager is a very powerful program that allows multiplexing several interactive shells. The sessions can be attached and detached, this is especially useful for sessions that are used on a remote sever: One can log on from a different computer, attach the tmux session and continue working in the same environment which was last encountered.
Also, two different people can simultaneously attach to the same tmux session.
Most important commands
[edit | edit source]Starting a new tmux session:
tmux
Attaching an already running tmux session:
tmux attach
list all running tmux sessions
tmux ls
Starting a new named tmux session:
tmux new -s my-project
Attaching to a named tmux session:
tmux attach -t my-project
From inside a tmux session, all tmux commands are started with the tmux prefix key Ctrl+b and then another key. Everything else you type, tmux forwards unchanged to whatever is running inside the current tmux window pane.
- Detach session: Ctrl+b d
- Switch to next session: Ctrl+b )
- Switch to previous session: Ctrl+b (
- Select the next pane in the current window: Ctrl+b o
Many people add a line
set-option -g prefix C-a
to their ~/.tmux.conf file, which changes the tmux prefix key to Ctrl+a (rather than the default Ctrl+b).
(Another Wikibook
has some tips on Interactive Sharing Using a Terminal Multiplexer, tmux).
(Further details: Tony Narlock. "The Tao of tmux". )