Tmux Cheat Sheet [Free PDF Download]

The tmux is a terminal multiplexer that allows you to manage multiple terminal sessions within a single window. It provides a range of features to enhance productivity, such as session management, window splitting, and session detachment. In this article, I am going to make a tmux cheat sheet for your perusal. So let’s start!

Download Tmux Cheat Sheet

Tmux cheat sheet image

Available Download Options


Most Popular

PDF (2 Pages)

DOC (2 Pages)

Combo Pack

ZIP (pdf, docx, png)

How to Install Tmux on Ubuntu

To install tmux on Ubuntu, you can use the package manager called apt. Here’s a step-by-step guide to installing tmux.

Steps to Follow >

➊  Open a terminal on your Ubuntu system using the keyboard shortcut Ctrl+Alt+T.

➋  Update the package lists and upgrade any existing packages on your system by running the following command:

sudo apt update && sudo apt upgrade

➌  The prompt will ask for your password. Enter your password to proceed further.update and upgrade of existing packages in ubuntu.➍  Once the package upgrade process is completed, you can install tmux by running the following command:

sudo apt install tmux

➎  Press ENTER to proceed with the installation.tmux installation in ubuntu terminal➏  Once the installation is complete, you can verify that tmux is installed by running the following command:

tmux -V

tmux installation verificationUpon completion of the installation, you should see the version number of tmux printed on the terminal.

List of Some Useful Shortcuts to Operate Tmux in Your Distribution

The tmux is a powerful terminal multiplexer that lets you manage multiple sessions, windows, and panes within a single window. It offers features like detach and attach, copy and paste, customization, and scripting, enhancing your productivity and workflow in the terminal.

Tmux Sessions

In tmux, sessions are a fundamental concept that allows you to manage and organize your terminal sessions. A session in tmux is a container that holds one or more windows, providing a way to group related terminal activities together. To create or manipulate a session you can follow the following shortcut.

Shortcuts Description
tmux new-session -s session_name Start a new session
tmux attach-session -t session_name Attach to an existing session
CTRL-B D Detach from the current session
tmux list-sessions List existing sessions
tmux switch-client -t session_name Switch to a different session
tmux rename-session -t old_name new_name Rename the current session

Windows Management

To create or maneuver a window in tmux, you can use the following key combination.

Shortcuts Description
CTRL-B C Create a new window
CTRL-B N Switch to the next window
CTRL-B P Switch to the previous window
CTRL-B 0-9 Switch to a specific window
CTRL-B , (comma) Rename the current window
CTRL-B & Close the current window

Note: Please note that when using tmux, keystrokes consist of two parts: a prefix and a command. The prefix, typically CTRL+B (C-b), needs to be pressed and released first, followed by quickly pressing the desired command. This two-step process allows you to execute specific actions in tmux. For instance, the shortcut CTRL-B C signifies that when you press CTRL-B together and then release them, followed by the C key, tmux will create a new window in the current session.

Panes Management

In tmux, panes are subdivisions within a window that allow you to split the terminal screen into multiple independent sections. Here are some shortcut keys you can use while working in tmux.

Shortcuts Description
CTRL-B % Split the current pane horizontally
CTRL-B Split the current pane vertically
CTRL-B Arrow keys or CTRL-B O Navigate between panes
CTRL-B CTRL-RightArrow Enlarge the current pane horizontally
CTRL-B CTRL-LeftArrow Shrink the current pane horizontally
CTRL-B CTRL-DownArrow Enlarge the current pane vertically
CTRL-B CTRL-UpArrow Shrink the current pane vertically
CTRL-D (when not running any programs) Close the current pane

Session Management

Session management is an important aspect of working with tmux. You can detach from a session without losing your work and reattach it later. Here’s an overview of session management in tmux.

Shortcuts Description
CTRL-B C Create a new session
CTRL-B N Switch to the next session
CTRL-B P Switch to the previous session
CTRL-B (number) Switch to a specific session
CTRL-B D Detach from the current session
CTRL-B $ Rename the current session
CTRL-B S List sessions

Copy Mode

In tmux, Copy Mode allows you to scroll through the terminal output and select and copy text for further use. It provides a convenient way to review past command output or copy important information without leaving the tmux session.

Shortcuts Description
setw -g mode-keys vi Use vi keys in buffer
CTRL + B [ Enter copy mode
CTRL + B PgUp Enter copy mode and scroll one page up
q Quit mode
g Go to top line
G Go to bottom line
Scroll up Scroll down
h Move cursor left
j Move cursor down
k Move cursor up
l Move cursor right
w Move cursor forward one word at a time
b Move cursor backward one word at a time
/ Search forward
? Search backward
n Next keyword occurrence
N Previous keyword occurrence
Spacebar Start selection
Esc Clear selection
Enter Copy selection
CTRL + B ] Paste contents of buffer_0

Variables

tmux provides various variables that you can use to customize and configure its behavior. These variables are typically defined in the .tmux.conf configuration file in your home directory. Here are some commonly used tmux variables:

Shortcuts Description
#(date) Shell command
#I Window index
#S Wession name
#W Window name
#F Window flags
#H Hostname
#h Hostname, short
#D Pane id
#P Pane index
#T Pane title

Miscellaneous

Here are a few miscellaneous features and commands that you can follow while working with tmux.

Shortcuts Description
CTRL-B D Detach from the current tmux session.
CTRL-B ? Display the tmux help window.
CTRL-B Z Toggle pane zoom (enlarge/shrink the current pane).
CTRL-B [ Enter copy mode for scrolling through the terminal output.
CTRL-B ] Paste the copied text from copy mode.

Conclusion

In conclusion, this article covers some basic commands and shortcuts associated with tmux cheat sheet such as session management, window and pane manipulation, Copy-Paste, and customization. By using the cheat sheet, you can improve productivity in the terminal by efficiently managing sessions, windows, and panes, as well as customizing tmux to suit your needs. However, if you have any questions or queries related to this article feel free to comment below. Thank You!

5/5 - (1 vote)
LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now
icon linux

Mohammad Shah Miran

Hey, I'm Mohammad Shah Miran, previously worked as a VBA and Excel Content Developer at SOFTEKO, and for now working as a Linux Content Developer Executive in LinuxSimply Project. I completed my graduation from Bangladesh University of Engineering and Technology (BUET). As a part of my job, i communicate with Linux operating system, without letting the GUI to intervene and try to pass it to our audience.

Leave a Comment