How to use tmux for terminal multiplexing
· Category: Linux
Short answer
Start a tmux session with tmux new -s mysession, detach with Ctrl+b d, and reattach with tmux attach -t mysession. Tmux keeps processes running after disconnecting. For scripting tmux workflows, see how to write bash scripts. For managing tmux as a system service, see how to use systemd.
Steps
- Start a named session:
tmux new -s work - Split panes:
Ctrl+b %(vertical) orCtrl+b "(horizontal) - Switch panes:
Ctrl+b arrow-key - Detach:
Ctrl+b d - Reattach later:
tmux attach -t work
Tips
- Use
tmux lsto list active sessions - Customize key bindings in
~/.tmux.conf - Combine tmux with how to configure SSH key-based login for resilient remote development