Linux

The Essential Tmux Commands Cheat Sheet

Bertel King 04-04-2020

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.

Advertisement

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

ShortcutAction
General
¹Ctrl + bDefault prefix key
tShow time (ESC returns to the terminal)
:Enter a command (Example: ":new-session")
list-commandsList all commands that tmux supports
Tmux Terms
PaneAn open command prompt (or pseudo-terminal). Panes may appear side by side or vertically stacked inside a window.
WindowYour view of open panes
SessionA set of open windows
ClientThe background process that displays your session
ServerA 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
oSwitch to the next pane
qShow pane numbers (when numbers appear, press number to switch to that pane)
{Move current pane to the left
}Move current pane to the right
xClose the current pane
Ctrl + Resize pane in steps of one cell
Alt + Resize pane in steps of five cells
Alt + 1Arrange panes in the even-horizontal preset layout
Alt + 2Arrange panes in the even-vertical preset layout
Alt + 3Arrange panes in the main-horizontal preset layout
Alt + 4Arrange panes in the main-vertical preset layout
Alt + 5Arrange panes in the tiled preset layout
Creating and Managing Windows
cCreate a new window
!Detach pane into a new window
nSwitch to the previous window (in order of creation)
pSwitch to the next window (in order of creation)
lSwitch to the window used most recently
wList all windows and their corresponding numbers
Switch to the corresponding window
,Rename current window
iDisplay info about the current window
fSearch for text in open windows (ESC exits the search)
Creating and Managing Sessions
new-sessionCreate a new session
$Rename current session
list-sessionsList open sessions
attach-sessionCreate a new client and attach it to the specified session (-t target-session)
detach-client -s target-sessionDetach clients attached to the current session
kill-sessionDestroy 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:

Advertisement

/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 The Linux Commands Reference Cheat Sheet This simple cheat sheet will help you get comfortable with the Linux command line terminal in no time. Read More  next.

Related topics: Cheat Sheet, Command Prompt, Terminal.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Advertisement
Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *