I have been using tmux for few years now and it has become one of my favourite tools for working in terminal environments. I have compiled a list of most essential tmux commands that help me to do my work more efficiently.

Minimal Tmux config file

My minimal tmux config ~/.tmux.config

# remap prefix to Control + a
set -g prefix C-a

# bind 'C-a C-a' to type 'C-a'
bind C-a send-prefix
unbind C-b

Tmux main commands

List sessions:

$ tmux ls
prometheus: 1 windows (created Fri May 12 13:34:23 2017) [194x53]

Create a new session:

$ tmux new -s packer

Attach the xisting session:

$ tmux a -t <session>

Rename the session:

$ rename-session -t <old session> <new session>

Kill the session:

$ kill-session -t <session>

Tmux Controls

Note that all key shortcuts use my custom tmux configuration file.

Detach the current session

^a d

List sessions

^a =

Buffers

^a <PgUpDn>

Command

^a : <command>

Tmux Sessions

New session

^a :new

New session (start session from the command line)

tmux -s new <session-name> 

Rename current session

^a $

List sessions

^a s

Next session

^a (

Previous session

^a )

List sessions and join one from the list

^a s <PgUpDn>

Tmux Windows (Tabs)

List windows

^a w

Create new window

^a c

Rename the window:

^a , <new window name>

Close the window

^a &

Goto the window number…

^a <0-9>

Go to the next window

^a n

Goto the previous window

^a p

Go to the window

^a w <name>

Tmux Panes (split windows)

Show

^a q

Split the current window horizontaly

^a "

Split the window vertically

^a %

Change from pane to window

^a !

Kill the pane

^a x

Reorganize panes

^a <space>

Expand the pane

^a <alt><arrow>

Resize the pane

^a ^<arrow>

Resize the pane by x

^a <n> <arrow>

Select the pane

^a <arrow>

Go the the previous pane

^a {

Go to the next pane

^a }

Switch panes

^a o

Swap thepanes

^a ^o

Go the last pane

^a ;