tmux quick reference

Reference commands for the tmux terminal multiplexer.

tmux is an excellent terminal multiplexer that enables multiple windows within a single terminal session.

Installation

conda method

Install using conda package manager. Recommended if you don’t have sudo access.

conda install tmux

yum method

Install using yum package manager. Recommended when working on a VM with sudo access.

sudo yum install tmux

Now that tmux is installed, here’s how to check the version.

tmux -V

Working with sessions

List sessions.

tmux ls

Create a new session.

tmux new -s [name of session]

Attach the most recent session.

tmux a

Attach a previous session by name.

tmux a -t [name of session]

Attach a session by number.

tmux attach-session -t 3

Detach from active session (rather than exiting).

Enable scrolling

This is useful when needing to parse console output (e.g. interactive logs). Modified from StackExchange.

  1. Ctrl-b then [. The line numbers should appear in the top right corner.
  2. Now you can use your normal navigation keys to scroll around (eg. Up Arrow or PgDn).
  3. Press q to quit scroll mode.

Copying text in paned mode

  1. Ctrl-b then z.
  2. Copy the desired text. Can use the mouse, but we recommend using vim or spacemacs when working with text instead.
  3. Ctrl-b then z.