Tmux cheat sheet: the commands you need from your phone

4 November 2026 · Daniel Bilsborough · Reviewed 4 November 2026

Tmux keeps terminal sessions running on a server after you disconnect. These are the commands for starting, attaching, detaching, listing and killing sessions, plus scrollback, mouse mode and the two config lines that make Tmux work well over SSH from an iPhone or iPad.

Everything here uses stock Tmux defaults, so the prefix is Ctrl-b. Press the prefix, let go, then press the next key.

Sessions: start, list, attach, kill

A session is the thing that survives when the SSH connection drops. Name each one, so attaching later is one short command.

CommandWhat it does
tmux new -s workStart a new session called work
tmux lsList sessions (short for tmux list-sessions)
tmux attach -t workAttach to the session called work
tmux aAttach to the most recent session
tmux attach -d -t workAttach and detach any other client, so the window resizes to this screen
tmux new -A -s workAttach to work if it exists, create it if it doesn't
tmux rename-session -t work agentsRename a session (inside Tmux: Ctrl-b $)
tmux kill-session -t workKill one session and everything running in it
tmux kill-session -aKill every session except the current one
tmux kill-serverKill all sessions and the Tmux server

How to attach to a Tmux session you didn't name: run tmux ls, read the number at the start of the line, then tmux attach -t 0. Inside Tmux, Ctrl-b s shows a session list you can pick from.

Detach: leave Tmux without killing the session

Ctrl-b d detaches. The session and whatever runs in it keep going on the server, and tmux attach brings you back to the same screen. From a shell you can also run tmux detach.

Typing exit, or closing the last shell in the session, ends the session. That's the difference between exiting a Tmux session and detaching from it: detach to leave something running, exit to finish.

A dropped SSH connection counts as a detach. That is why Tmux matters on a phone: lock the screen, lose signal, or switch to another app, and a long job or an AI coding agent keeps running on the server.

Windows and panes

A window is a full screen inside a session. A pane is a split of a window. On a phone screen, windows are usually easier to read than panes.

KeysWhat it does
Ctrl-b cNew window
Ctrl-b n / Ctrl-b pNext / previous window
Ctrl-b 0 to 9Jump to a window by number
Ctrl-b wPick a window from a list
Ctrl-b ,Rename the current window
Ctrl-b &Kill the current window (asks first)
Ctrl-b %Split into left and right panes
Ctrl-b "Split into top and bottom panes
Ctrl-b then an arrow keyMove to the pane in that direction
Ctrl-b zZoom the current pane to the full window, and back
Ctrl-b xKill the current pane (asks first)
Ctrl-b ?List every key binding

Scrollback: reading what scrolled off the screen

Tmux keeps its own history, so the terminal's normal scroll doesn't reach it. Two ways in:

Tmux keeps 2,000 lines per pane by default. Agent output runs long, so raising it is worth it:

set -g history-limit 50000

The new limit applies to panes created after the change.

The tmux.conf lines that matter over SSH

These go in ~/.tmux.conf on the server. Each one is a standard Tmux option.

# Scroll and select with a mouse, trackpad or finger
set -g mouse on

# More history per pane
set -g history-limit 50000

# Publish the session name as the terminal title
set -g set-titles on
set -g set-titles-string '#S'

# Let copies inside Tmux reach the client's clipboard (OSC 52)
set -g set-clipboard on

Reload without restarting Tmux:

tmux source-file ~/.tmux.conf

To have Claude or Cursor write a tailored version, add the free Shell Drop MCP connector and ask it for a phone-friendly tmux.conf.

What each line is for:

Tmux on a phone with Shell Drop

Shell Drop is a free SSH client for iPhone, iPad and iPhone Duo, built around Tmux. Here's how the commands above map to it.

The terminal app for iPhone page covers the SSH setup, and Claude Code on iPhone and Codex on iPhone cover running a coding agent in a Tmux session.

Questions

How do I attach to a tmux session?

Run tmux ls to list sessions, then tmux attach -t name with the session's name or number. tmux a attaches to the most recent one, and tmux new -A -s name attaches if the session exists and creates it if not.

How do I detach from tmux without killing the session?

Press Ctrl-b, then d. The session keeps running on the server and tmux attach brings it back. Typing exit closes the shell, and closing the last shell ends the session.

How do I kill a tmux session?

tmux kill-session -t name kills one session. tmux kill-session -a kills every session except the current one, and tmux kill-server kills them all.

How do I scroll up in tmux?

Press Ctrl-b then [ to enter copy mode, move with the arrow keys or Page Up, and press q to leave. Or add set -g mouse on to ~/.tmux.conf and scroll with a mouse, trackpad or swipe.

What does set -g mouse on do?

It turns on Tmux mouse mode: scrolling moves through the Tmux history, clicking selects panes and windows, and dragging selects text. Put it in ~/.tmux.conf, then run tmux source-file ~/.tmux.conf.

Can I use tmux from an iPhone?

Yes. Tmux runs on the server, so any SSH client can attach to it. Shell Drop adds a Tmux prefix on the toolbar, swipe scrolling, tab names from session names and auto-attach for restored tabs. It is free.

Get Shell Drop on the App Store QR code for Shell Drop on the App Store Reading on a computer? Scan the code with your iPhone camera.