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

  1. Start a named session: tmux new -s work
  2. Split panes: Ctrl+b % (vertical) or Ctrl+b " (horizontal)
  3. Switch panes: Ctrl+b arrow-key
  4. Detach: Ctrl+b d
  5. Reattach later: tmux attach -t work

Tips