Terminal

tmux Cheat Sheet: Sessions, Windows and Split Panes

Nemo · · 5 min read

Every tmux shortcut starts with the prefix, Ctrl+b by default: press it, let go, then press the command key. Ctrl+b then % splits the pane left and right, Ctrl+b then “ splits it top and bottom, Ctrl+b then an arrow moves between panes, and Ctrl+b then d detaches the session so it keeps running after you close the terminal. The tables below cover the keys you use every day, all with tmux’s default bindings.

Why keep a tmux cheat sheet?

tmux has a lot of keys, and you’ll use about ten of them daily. The rest you look up, usually in the middle of something: a server is running in one pane, logs in another, and you can’t remember how to zoom. A short sheet you trust is faster than a man page, because the man page lists every option and you need one key. In the tables, “prefix” means Ctrl+b.

Which commands manage sessions?

A session is a set of windows that lives on after you detach.

Action Command or keys
New named session tmux new -s work
List sessions tmux ls
Attach to a session tmux attach -t work (or tmux a)
Detach prefix, then d
Pick a session from a list prefix, then s
Rename the session prefix, then $
Kill a session tmux kill-session -t work

Which keys manage windows?

A window is a full screen inside a session, like a tab.

Action Keys
New window prefix, then c
Rename window prefix, then ,
Next / previous window prefix, then n / p
Go to window 0 to 9 prefix, then the number
Choose from a list prefix, then w
Close window prefix, then &

How do you split and move between panes?

Panes are the reason to install tmux: the server, the logs and an editor stay in view at once, so you never swap windows to check one.

Action Keys
Split left and right prefix, then %
Split top and bottom prefix, then “
Move to a pane prefix, then an arrow key
Next pane prefix, then o
Zoom a pane (and back) prefix, then z
Swap with previous / next prefix, then { / }
Cycle layouts prefix, then Space
Show pane numbers prefix, then q
Turn a pane into a window prefix, then !
Resize prefix, then Ctrl+arrow
Close the pane prefix, then x

How do you scroll and copy?

Press prefix, then [ to enter copy mode. Scroll with the arrow keys or Page Up and Page Down, and press q to leave. Prefix, then ] pastes the last buffer. With set -g mouse on in your config, the trackpad scrolls and selects too.

Two more keys worth remembering: prefix, then ? lists every binding, and prefix, then : opens the command prompt.

What goes in a basic .tmux.conf?

The config lives in ~/.tmux.conf. A small start:

set -g mouse on
set -g base-index 1
set -g prefix C-a
unbind C-b
bind C-a send-prefix

That turns on the mouse, numbers windows from 1 (so the first window sits on the 1 key, at the left of the number row) and moves the prefix to Ctrl+a, which is easier to reach than Ctrl+b. Reload it inside tmux with prefix, then :source-file ~/.tmux.conf. On a Mac, install tmux with Homebrew: brew install tmux.

Can you get tmux-style panes without tmux?

For terminals inside a browser window, yes. Monok is a Mac browser where every tab is a tree of panes, and a pane can be a web page or a native terminal running your login shell. The keys are Mac shortcuts, with no prefix:

tmux Monok
prefix, then % Cmd+D splits right
prefix, then “ Shift+Cmd+D splits down
prefix, then arrow Option+Cmd+arrow moves the focus
prefix, then { or } Option+Shift+Cmd+arrow swaps panes
prefix, then z Shift+Cmd+Return zooms a pane
prefix, then x Cmd+W closes the pane

Option+Cmd+= evens the panes out, and Ctrl+` splits a terminal in under the page. Pane layouts come back with the session, but a shell doesn’t: a terminal comes back as an empty pane. That is the honest difference: Monok panes don’t detach and don’t run on a remote server. For that, keep using tmux, inside a Monok terminal pane if you like.

The rest of the browser follows the same keyboard-first idea; the Mac browser shortcuts guide covers the keys that work everywhere, and the Safari ad blocker guide explains the blocking built into Monok. The home page has the full tour.

Try it: download Monok for Mac, free while in preview, macOS 14 or later.

FAQ

What is the tmux prefix key?

Ctrl+b by default. Press it, release it, then press the command key. Many people move it to Ctrl+a in ~/.tmux.conf.

How do I split a pane vertically in tmux?

Prefix, then % puts two panes side by side. Prefix, then “ stacks them top and bottom.

How do I exit tmux without killing my session?

Detach with prefix, then d. tmux attach brings it back.

Does Monok replace tmux?

Not for remote servers or detached sessions. It gives you tmux-style panes for pages and local terminals in one Mac window. Get it on the download page.

More in Terminal

Contact

Bug reports, sites you want to see working, ideas. We reply by email.