The Essential Tmux Commands Cheat Sheet

Delta Online News
multitask-linux-terminal

Running commands in the terminal allows you to do many tasks more quickly than you could using a graphical application. But command prompts aren’t all that great for multitasking, at least not without some help. And that’s where tmux comes in.

Tmux or terminal multiplexer is a command line program that enables you to run and view multiple commands in a single terminal window simultaneously. Each command exists in its own window pane as though you were using a full-blown tiling window manager.

To help you get started with tmux, we have compiled key tmux terms and commands in the cheat sheet below.

FREE DOWNLOAD: This cheat sheet is available as a downloadable PDF from our distribution partner, TradePub. You will have to complete a short form to access it for the first time only. Download The Essential Tmux Commands Cheat Sheet.

The Essential Tmux Commands Cheat Sheet

Shortcut Action
General
¹Ctrl + b Default prefix key
t Show time (ESC returns to the terminal)
: Enter a command (Example: “:new-session”)
list-commands List all commands that tmux supports
Tmux Terms
Pane An open command prompt (or pseudo-terminal). Panes may appear side by side or vertically stacked inside a window.
Window Your view of open panes
Session A set of open windows
Client The background process that displays your session
Server A single server manages all open sessions (Servers and clients are separate processes that each communicate through a socket in /tmp.)
Creating and Managing Panes
% Split screen or pane in half vertically, creating a new pane on the right
Split screen or pane in half horizontally, creating a new pane at the bottom
Switch to the adjacent pane
o Switch to the next pane
q Show pane numbers (when numbers appear, press number to switch to that pane)
{ Move current pane to the left
} Move current pane to the right
x Close the current pane
Ctrl + Resize pane in steps of one cell
Alt + Resize pane in steps of five cells
Alt + 1 Arrange panes in the even-horizontal preset layout
Alt + 2 Arrange panes in the even-vertical preset layout
Alt + 3 Arrange panes in the main-horizontal preset layout
Alt + 4 Arrange panes in the main-vertical preset layout
Alt + 5 Arrange panes in the tiled preset layout
Creating and Managing Windows
c Create a new window
! Detach pane into a new window
n Switch to the previous window (in order of creation)
p Switch to the next window (in order of creation)
l Switch to the window used most recently
w List all windows and their corresponding numbers
Switch to the corresponding window
, Rename current window
i Display info about the current window
f Search for text in open windows (ESC exits the search)
Creating and Managing Sessions
new-session Create a new session
$ Rename current session
list-sessions List open sessions
attach-session Create a new client and attach it to the specified session (-t target-session)
detach-client -s target-session Detach clients attached to the current session
kill-session Destroy the current or specified session
¹To activate a shortcut, you must first press and release the prefix key, then press the shortcut key.

More Help With the Linux Command Line

The commands above help you work in tmux using multiple panes, windows, and sessions. If you really want to make tmux your own, you can go further by editing the configuration file stored at the following location:

/etc/tmux.conf

You can also try your hand at scripting.

When you’re working exclusively from the terminal, installing tmux is akin to installing a window manager. This gives you more flexibility when working on servers or other devices without an attached screen. Have fun exploring tmux! And if you’re looking for more command line resources, take a look at our Linux commands reference cheat sheet next.

Read the full article: The Essential Tmux Commands Cheat Sheet

MakeUseOf