Tmux is a simple yet powerful terminal multiplexer for UNIX-based machines. It allows you to seamlessly create and manage multiple terminal windows from a single teletype terminal (TTY). Tmux does this by creating self-contained pseudo-terminals which it serves to the user. This approach allows tmux to create terminal windows that persist across sessions. Not only that, this also allows it to easily transfer information and modify different terminals.
Because of that, tmux is a staple program for both everyday users and system administrators alike. Its ability to provide a persistent terminal session means that you can run tmux remotely and run programs without the risk of terminating them upon disconnecting. Furthermore, its ability to manipulate terminal windows makes it a simple window manager for power users.
Download this Cheatsheet
Enter your email below to receive this PDF cheatsheet in your Inbox.
Essential Tmux Keybindings
Although tmux offers many benefits, one key difficulty new users run into with tmux is its unusual and unintuitive keybinding syntax. While it is possible to remap the tmux keybinding in your system, you may not be able to load a custom configuration into every system you might work with. Therefore, you will likely still want to know how the default tmux system works. This cheatsheet aims to teach you the basics of how to use tmux’s arcane bindings.
Shortcut | Function |
---|---|
General Keybindings | |
Ctrl + B | The default leader key. |
Ctrl + B, then ? | Open tmux’s help menu. |
Ctrl + B, then ~ | Display all the system messages for the current session. |
Ctrl + B, then Ctrl + B | Send the leader key through the terminal. |
Ctrl + B, then : | Open the command buffer. |
Ctrl + B, then Ctrl + Z | Suspend the current tmux client. |
Ctrl + B, then D | Detach the current session from the active terminal. |
Ctrl + B, then Shift + D | Open a prompt to select which session to detach. |
Ctrl + B, then S | Switch to a different session. |
Ctrl + B, then ( | Move the current client to the previous session. |
Ctrl + B, then ) | Move the current client to the next session. |
Ctrl + B, then R | Redraw the current screen. |
Ctrl + B, then T | Show the current time. |
Window Management | |
Ctrl + B, then C | Create a new window. |
Ctrl + B, then & | Delete the currently selected window. |
Ctrl + B, then I | Briefly display information about the currently selected window. |
Ctrl + B, then N | Go to the next window in the session. |
Ctrl + B, then P | Go to the previous window in the session. |
Ctrl + B, then Alt + N | Go to the next window with a marker. |
Ctrl + B, then Alt + P | Go to the previous window with a marker. |
Ctrl + B, then , | Change the label of the current window. |
Ctrl + B, then . | Change the index number of the current window. |
Ctrl + B, then L | Go back to the previously selected window. |
Ctrl + B, then 0-9 | Go to the window with the corresponding index number. |
Ctrl + B, then ‘ | Open a prompt to directly switch to a specific index number. |
Ctrl + B, then W | Open a prompt to interactively select the window to switch to. |
Ctrl + B, then F | Search for windows that contain a specific text string. |
Pane Management | |
Ctrl + B, then Q | Show the pane index for the currently visible screen. |
Ctrl + B, then % | Create a new vertically split pane in the current window. |
Ctrl + B, then “ | Create a new horizontally split pane in the current window. |
Ctrl + B, then X | Delete the currently selected pane. |
Ctrl + B, then ! | Put the currently selected pane to a different window. |
Ctrl + B, then ; | Select the previously active pane. |
Ctrl + B, then M | Mark the current pane. |
Ctrl + B, then Shift + M | Unmark the current pane. |
Ctrl + B, then O | Select the next pane in the currently selected window. |
Ctrl + B, then { | Swap the currently selected pane with the previous one in the index. |
Ctrl + B, then } | Swap the currently selected pane with the next one in the index. |
Ctrl + B, then Up | Select the pane above the currently selected pane. |
Ctrl + B, then Down | Select the pane below the currently selected pane. |
Ctrl + B, then Left | Select the pane on the left of the currently selected pane. |
Ctrl + B, then Right | Select the pane on the right of the currently selected pane. |
Pane Layouts | |
Ctrl + B, then Alt + 1 | Arrange the layout of the panes in the current window to a horizontally stacked layout. |
Ctrl + B, then Alt + 2 | Arrange the layout of the panes in the current window to a vertically stacked layout. |
Ctrl + B, then Alt + 3 | Arrange the layout of the panes in the current window to a horizontal master-stack layout. |
Ctrl + B, then Alt + 4 | Arrange the layout of the panes in the current window to a vertical master-stack layout. |
Ctrl + B, then Alt + 5 | Arrange the layout of the panes in the current window to a tiled layout. |
Ctrl + B, then Space | Cycle through all of the default layouts in the current window. |
Ctrl + B, then Ctrl + Up | Increase the size of the currently selected pane by one row upwards. |
Ctrl + B, then Ctrl + Down | Increase the size of the currently selected pane by one row downwards. |
Ctrl + B, then Ctrl + Left | Increase the size of the currently selected pane by one row leftwards. |
Ctrl + B, then Ctrl + Right | Increase the size of the currently selected pane by one row rightwards. |
Text Copy Mode | |
Ctrl + B, then [ | Switch the current session to tmux’s text copy mode. |
G | Go to the top line of the current window. |
Shift + G | Go to the bottom line of the current window. |
/ | Do a forward search for a keyword. |
? | Do a backward search for a keyword. |
N | Highlight the next occurrence of a keyword. |
Shift + N | Highlight the previous occurrence of a keyword. |
K Up Arrow | Move the cursor one line upwards. |
J Down Arrow | Move the cursor one line downwards. |
H/Left Arrow | Move the cursor one character leftwards. |
L/Right Arrow | Move the cursor one character rightwards. |
W | Move the cursor one word forward. |
B | Move the cursor one word backward. |
Ctrl + Space | Start the text selection at the current point. |
Ctrl + W | Copy the selected text to the paste buffer. |
Q | Switch the current window back to a regular tmux session. |
Ctrl + B, then ] | Paste the contents of the last buffer to the current window. |
Ctrl + B, then = | Open the list of currently active sessions and select where to paste the current selection. |
Image credit: Unsplash
Our latest tutorials delivered straight to your inbox