TMUX Cheatsheet
A handy tmux cheatsheet for developers. It covers the most common commands and shortcuts for managing terminal sessions efficiently.
Starting tmux
- Start a new session:
tmux - Start a named session:
tmux new -s <session-name>
Detaching and Reattaching
-
Detach from the current session:
Ctrl + bthend
(HoldCtrl, pressb, release both, then pressd) -
List all sessions:
tmux ls -
Reattach to a session:
tmux attach -t <session-name>
Working with Windows
-
Create a new window:
Ctrl + bthenc -
Switch to the next window:
Ctrl + bthenn -
Switch to the previous window:
Ctrl + bthenp -
Rename the current window:
Ctrl + bthen, -
Close the current window:
Ctrl + bthen& -
List all windows:
Ctrl + bthenw
Working with Panes
-
Split pane horizontally:
Ctrl + bthen" -
Split pane vertically:
Ctrl + bthen% -
Switch to the next pane:
Ctrl + btheno -
Close the current pane:
Ctrl + bthenx -
Resize pane:
Ctrl + bthen:thenresize-pane -[L|R|U|D] <size> -
Zoom into a pane (maximize):
Ctrl + bthenz
(Press again to unzoom)
Session Management
-
Kill a session:
tmux kill-session -t <session-name> -
Kill all sessions:
tmux kill-server -
Rename a session:
Ctrl + bthen$
Copy Mode (for scrolling and copying)
-
Enter copy mode:
Ctrl + bthen[ -
Scroll up/down:
UseUp/Downarrows orPage Up/Page Down -
Start selecting text:
PressSpacebar -
Copy selected text:
PressEnter -
Paste copied text:
Ctrl + bthen]
Customization
-
Edit the tmux configuration file (
~/.tmux.conf):nano ~/.tmux.conf -
Reload the configuration:
Ctrl + bthen:thensource-file ~/.tmux.conf
More Tips
- Enable mouse mode: Add this to your
~/.tmux.confto enable mouse support:set -g mouse on - Use tmux with SSH: Keep your sessions alive even if your SSH connection drops.