Skip to content

Tmux Cheat Sheet

At some point, every engineer or researcher needs to work in the command line.

Tmux makes that work easier by keeping sessions alive, organizing multiple tasks, and letting you reconnect without losing progress. It is especially useful for remote servers, long-running jobs, and multitasking in a terminal.

Below is a concise and practical tmux cheat sheet covering the most useful commands for daily terminal workflows, session management, window navigation, and productivity.

Tmux

Tmux is a terminal multiplexer that helps you manage multiple tasks and workflows.

With tmux, you can:

  • Sessions: Preserve your work and keep tasks running, even if you log out or disconnect.
  • Windows: Create separate workspaces for different projects or tools within the same session.
  • Panes: Split a window into multiple views so you can monitor and interact with several processes side by side.

Terminal + Starship + Tmux

Often pre-installed.

Install Tmux using Homebrew:

Terminal window
brew install tmux

Install Tmux via WSL (Windows Subsystem for Linux):

Terminal window
sudo apt update
sudo apt install tmux
Terminal window
tmux
Terminal window
tmux new -s <session-name>
Terminal window
tmux ls
Terminal window
tmux attach -t <session-name>
tmux a -t <session-name>
Terminal window
tmux kill-session -t <session-name>
Terminal window
tmux kill-server
Ctrl-b $
Ctrl-b s

Leave the current tmux session running in the background so you can come back to it later.

Ctrl-b d
Ctrl-d
Ctrl-b c
Ctrl-b ,
Ctrl-b w
Ctrl-b n
Ctrl-b p
Ctrl-b 0
Ctrl-b ...
Ctrl-b 9
Ctrl-b &
Ctrl-b %
Ctrl-b "
Ctrl-b ← ↓ ↑ →
Ctrl-b hold Ctrl ← ↓ ↑ →

macOS only:

Ctrl-b hold Shift + Option ← ↓ ↑ →
Ctrl-b z
Ctrl-b Space
Ctrl-d

You can search through your tmux history using copy mode. This allows you to scroll back and find specific text in the buffer.

  1. Enter tmux copy mode:

    Ctrl-b [
  2. Start a search:

    Search downwards:

    Ctrl-s

    Search upwards:

    Ctrl-r
  3. Type your search term and press Enter.

  4. Navigate through matches:

    Press n to jump to the next occurrence.

    Press N to jump to the previous occurrence.

  5. Exit copy mode:

    Press q or Escape twice to exit copy mode.

When you have multiple windows open, you can quickly jump to one based on text currently displayed inside it.

  1. Open the find-window prompt:

    Ctrl-b f
  2. Type your search term and press Enter.

  3. Select the matching window:

    If there’s only one match, tmux will switch to it automatically.

    If multiple windows match, you’ll see a list and can choose the one you want.

We’ve demystified the essential tmux shortcuts you need to manage sessions, switch between windows, and stay organized while working in the terminal.

With these foundations in place, you’re ready to build a faster, more efficient command-line workflow using tmux every day.

This is just the beginning of your journey. May the Force be with you!