This post provides some common tmux shortcuts. A great list can be found here.

Prefix key (default):

Almost all tmux shortcuts require the Prefix key to be pressed first.

By default, it is Ctrl-b

(hold the Ctrl key and then press the b key).

Prefix key (recommended):

However, a popular alternative is to set the Prefix key to Ctrl-a (which my tmux.conf file uses).

Ctrl-a hold the Ctrl key and then press the a key

Shortcuts specified by my tmux.conf *

All the commands below with a '*' indicate that they have been specified in my tmux.conf file, which uses Ctrl-a as the prefix key.

General:

Prefix ? see list of available shortcuts

Panes:

Prefix -* horizontal split
Prefix \* vertical split (on an American keyboard \ is the same key as |)
Alt ↑* Move to pane above
Alt ↓* Move to pane below
Alt ←* Move to pane on the left
Alt →* Move to pane on the right
Prefix " horizontal split (default)
Prefix % vertical split (default)
Prefix o go to the next pane (cycle through all of them)
Prefix ; go to the 'last' (previously used) pane
Ctrl-d kill pane
Prefix [ enter the pane, and use arrows to navigate up/down. Press Enter to return
Prefix { Swaps panes
Prefix } Swaps panes

Note: if you are using iTerm as your terminal emulator, you may need to check your settings for the 'meta' key: iTerm → Preferences → Profiles → Keys → Left/Right option keys acts as: +Esc

Windows:

Prefix c new window
Prefix n next window (cycle through windows)
Prefix p previous window
Prefix l 'last' (previously used) window
Prefix & kill window (then press y)

Sessions:

Prefix ( previous session
Prefix ) next session
Prefix ) next session
Prefix L 'last' (previously used) session
Prefix s choose a session from a list

Reloading .tmux.conf

Prefix r* reloads

tmux-resurrect:

Prefix Ctrl-s* save current tmux session
Prefix Ctrl-r* reload saved tmux session

Any command:

Prefix : prompt appears, and can then type any command, e.g. kill-session

From outside a tmux session

tmux ls see list of detached/attached tmux sessions
tmux kill-session -t 0 kill session 0 (or replace 0 with other session number)

Creating your own shortcuts

The following is a quick guide to setting your own shortcuts.

Step 1: check the current shortcuts

First use prefix ? to see which keys have already been bound (to specific shortcuts).

Remember that C-x means Ctrl x and M-x means Alt x (if using iTerm, you may need to check your settings for the 'meta' key: iTerm → Preferences → Profiles → Keys → Left/Right option keys acts as: +Esc

Step 2: unbind any keys

Suppose you want to use prefix p to do something (currently used for going back one window).

unbind-key -T prefix p

I think the following is equivalent:

unbind prefix p

Step 3: set new keys (prefix, no prefix, repeatable?)

Suppose you want to now bind prefix Alt h to moving one pane left. The following in your .tmux.conf will do this:

bind M-h select-pane -L

Using bind, it is implicit that prefix must be pressed before Alt h.

If you do not want to press prefix first, you can use the -n flag.

#do not need to press prefix first
bind -n M-h select-pane -L

If you want to use a command that you could repeat without needing to press the prefix, you can use the -r flag:

#only use prefix the first time, second time just Alt-h
bind -r M-h select-pane -L

The first time you move to the left pane, you need to use prefix Alt h, but if you want to immediately repeat the command, you only need to press Alt h. Another command where -r flag is useful is for resizing panes:

#Resizing pane (downwards) with prefix j
bind -r j resize-pane -D 2