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
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.➍ 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.➏ Once the installation is complete, you can verify that tmux is installed by running the following command:
tmux -V
Upon 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.
To create or maneuver a window in tmux, you can use the following key combination. 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. 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. 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. 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: Here are a few miscellaneous features and commands that you can follow while working with tmux. 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!
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
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
Panes Management
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
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
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
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
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
FUNDAMENTALS
A Complete Guide for Beginners