• Start an unnamed session: tmux
  • Start a named session: tmux new -s <name>
  • Attach: tmux a #
  • Attach to named session: tmux a -t <name>
  • Detch from session: Ctrl + b (or your custom <prefix>), then d
  • List all sessions: tmux ls
  • Kill a named session: tmux kill-ses -t <name>
  • Kill the server: tmux kill-server


Shortcuts for sessions:
<prefix>, d # detach from session
<prefix>, s # select from sessions
<prefix>, $ # rename session

<prefix>, ( # previous session
<prefix>, ) # next session
<prefix>, L # last session
Shortcuts for windows:
<prefix>, c 	# create new window
<prefix>, w 	# select from windows
<prefix>, , 	# rename window
<prefix>, & 	# kill window

<prefix>, p 	# previous window
<prefix>, n 	# next window
<prefix>, l 	# last window
<prefix>, [0-9]	# go to [0-9]th window
Shortcuts for Panes
<prefix>, % # vertical split
<prefix>, " # horizontal split
<prefix>, q # show pane numbers (when numbers are show, press number to select pane)
<prefix>, x # kill pane
<prefix>, o # swap panes
<prefix>, { # (Move the current pane left)
<prefix>, } # (Move the current pane right)
<prefix>, z # toggle pane zoom
<prefix>, <space> # toggle b/w layouts

Useful Commands

Entering the <prefix> gets you into the command mode, then

:new-window -a		# insert new window right next to current
:swap-window -t [pos]	# move curr window


Customizing <prefix>

If you wish to change the prefix from Ctrl + b to something like Ctrl + a, which some people prefer, you could create a file ~/.tmux.conf with the following:

# Remap tmux Prefix
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
1-indexing Windows

And if you don’t want the 0-indexing for your windows, since 1 is easier to press when switching, add the following as well:

# 1-index Windows
set -g base-index 1

When you are done, be sure

:source-file ~/.tmux.conf

Hey, kudos for making it this far! Wanted to let you know that if you liked this, you might also like How to Completely Remove VirtualBox from macOS.


I'm Bobby Yan, a programmer, music lover, researcher, and a third-year undergraduate student at UC Berkeley majoring in Electrical Engineering and Computer Science. I am currently doing research on robotics, planning, and systems for machine learning at RISELab. In the past, I built IB Notes, a website with useful and concise study guides and notes for IB, and Spanish Vocab Builder, an iOS app to help Spanish learners. See my résumé for more details.

If you enjoyed this article, you should follow me on Twitter or sign up to get an email whenever I write something new:

Share this article with your friends: