CyberCheatsheets

tmux Cheat Sheet

Terminal multiplexer for persistent sessions, split panes, and windows — keep shells alive across SSH drops.

Utilities & ShellsmultiplexerproductivitysessionsterminaltmuxUpdated 2026-06-17

Overview

tmux lets you run multiple terminals inside one screen, detach a session and reattach later (even after an SSH disconnect), and split the screen into panes. Essential for long-running scans and remote work. Every shortcut starts with the prefix key, Ctrl-b by default — written below as 'prefix'.

Authorized testing only. Use only on systems, networks, and accounts you own or have explicit written permission to test.

Sessions (from the shell)

Start a new unnamed session

tmux

Start a named session 'recon'

tmux new -s recon

List sessions

tmux ls

Reattach to session 'recon'

tmux attach -t recon

Kill a session

tmux kill-session -t recon

Sessions (inside tmux)

Detach (session keeps running in background)

prefix d

Interactive session switcher

prefix s

Rename current session

prefix $

Windows (tabs)

Create a new window

prefix c

Next / previous window

prefix n  /  prefix p

Jump to window by number

prefix 0-9

Rename current window

prefix ,

Kill current window

prefix &

Panes (splits)

Split vertically (side by side)

prefix %

Split horizontally (top/bottom)

prefix "

Move between panes

prefix <arrow>

Zoom/unzoom current pane to fullscreen

prefix z

Kill current pane

prefix x

Swap pane with previous / next

prefix {  /  prefix }

Copy mode & scrolling

Enter copy mode (then PgUp/arrows to scroll)

prefix [

In copy mode: start selection, then copy

Space ... Enter

Press q to exit copy mode.

Paste the tmux buffer

prefix ]

Quick one-liners

Attach to the last session, or create one if none exist

tmux a || tmux

Kill the tmux server and every session

tmux kill-server

Run a command in a new detached session

tmux new -d -s scan 'nmap -p- 10.10.10.5'

Reload config without restarting

tmux source-file ~/.tmux.conf

Tips

  • Detach (prefix d) before closing your laptop or dropping SSH — the session and its jobs survive.
  • Run long scans inside tmux so a disconnect never kills them.
  • Rebind the prefix to Ctrl-a in ~/.tmux.conf if Ctrl-b is awkward: set -g prefix C-a
  • Enable mouse mode for click-to-select panes: set -g mouse on

References

Aide-mémoires similaires