Table of Contents
In this tutorial I have consolidated a bunch of tmux cheatsheets and shortcuts which can help you with your time with tmux.
Recommended Read
I would recommend reading these articles on tmux to get more details on the commands used in these shortcuts from this article:
Complete tutorial on tmux commands with examples from scratch
10 practical examples of tmux configuration with examples
tmux cheatsheet for sessions
Command | Details |
---|---|
$tmux |
Create new session with default session name |
$tmux new |
Create new session with default session name |
$tmux new-session |
Create new session with default session name |
$tmux new -s session_name |
Creates a new session called “session_name.” |
Ctrl+b : |
Enters command mode |
Ctrl+b :new -s session_name |
Creates new session within an existing session |
$tmux ls |
List active tmux sessions |
$tmux list-sessions |
List active tmux sessions |
Ctrl+b s |
List active tmux sessions |
$tmux a -t session_name |
Attaches to session by the name "session_name" |
$tmux at -t session_name |
Attaches to session by the name "session_name" |
$tmux attach -t session_name |
Attaches to session by the name "session_name" |
$tmux attach-session -t session_name |
Attaches to session by the name "session_name" |
$tmux kill-ses -t session_name |
Kills session by the name "session_name" |
$tmux kill-session -t session_name |
Kills session by the name "session_name" |
Ctrl+b d |
Detaches from the session, leaving the session running in the background. |
Ctrl+b $ |
Rename the session name |
Ctrl+b ( |
Move to the previous session |
Ctrl+b ) |
Move to the next session |
tmux cheatsheet for windows
Prefix Command | Details |
---|---|
Ctrl+b c |
Creates a new window from within an existing tmux session |
Ctrl+b w |
Displays a list of windows in the current session |
Ctrl+b n |
Moves to the next window |
Ctrl+b p |
Moves to the previous window |
Ctrl+b 0..9 |
Selects windows by number |
Ctrl+b l |
Go to the last window |
Ctrl+b , |
Displays a prompt to rename a window |
Ctrl+b & |
Closes the current window after prompting for confirmation |
Ctrl+b x |
Closes the current window after prompting for confirmation |
Ctrl+b f |
Searches for a window that contains the text you specify |
tmux cheatsheet for panes
Prefix Command | Details |
---|---|
Ctrl+b % |
Divides the current window in half vertically. |
Ctrl+b " |
Divides the current window in half horizontally |
Ctrl+b o |
Cycles through open panes |
Ctrl+b q |
Momentarily displays pane numbers in each pane |
Ctrl+b x |
Closes the current pane after prompting for confirmation |
Ctrl+b & |
Closes the current window after prompting for confirmation |
Ctrl+b & |
Closes the current window after prompting for confirmation |
Ctrl+b Space |
Cycles through the various pane layouts |
Ctrl+b { |
Move the current pane to left |
Ctrl+b } |
Move the current pane to right |
Ctrl+b ⇑ |
Switch to the pane above the current pane |
Ctrl+b ⇓ |
Switch to the pane below the current pane |
Ctrl+b ⇐ |
Switch to the pane on the left side of the current pane |
Ctrl+b ⇒ |
Switch to the pane on the right side of the current pane |
Ctrl+b z |
Toggle pane zoom |
Ctrl+b ! |
Combine and Convert all the panes into single window |
Ctrl+b :setw synchronize-panes |
To synchronise all the panes |
Ctrl+b :setw synchronize-panes off |
To turn off synchronisation between all the panes |
tmux help
Prefix Command | Details |
---|---|
Ctrl+b ? |
Show the list of bind options |
Ctrl+s |
In the bind help section search for string |
Conclusion
In this tmux cheatsheet tutorial I have tried to consolidate all the most used shortcuts and tmux commands into a single page. There are many other key combinations which can be used with tmux and those can be easily accessed with the man page of tmux.
Lastly I hope this tmux cheatsheet was helpful. So, let me know your suggestions and feedback using the comment section.
References
I discovered a great plugin for tmux for logging screen output
This plugin requires tmux 1.9 or later
https://github.com/tmux-plugins/tmux-logging