Tmux Commands Cheatsheet
Tmux is a powerful terminal multiplexer that allows you to manage multiple terminal sessions, windows, and panes within a single terminal window. This cheatsheet provides essential Tmux commands to enhance your command-line productivity.
Tmux Session Management
Manage your Tmux sessions efficiently with these commands.
# To start a new tmux session:
tmux
# To list all active tmux sessions:
tmux ls
# To attach to the most recently used session:
tmux attach
# To detach from the current session (leaves it running):
Ctrl-b d
# To detach an already attached session (useful for moving between devices):
tmux attach -d
# To rename the current session:
Ctrl-b $
# To switch between sessions:
Ctrl-b s
# To start a shared session (multiple users can connect):
tmux -S /tmp/your_shared_session
chmod 777 /tmp/your_shared_session
Tmux Window Navigation and Management
Navigate and manage windows within your Tmux sessions.
# To create a new window:
Ctrl-b c
# To go to the next window:
Ctrl-b n
# To go to the previous window:
Ctrl-b p
# To destroy the current window:
Ctrl-b x
# To switch to a specific window by number:
Ctrl-b [0-9]
# To switch between windows using arrow keys (after splitting):
Ctrl-b Arrows
Tmux Pane Management
Split your terminal into multiple panes for better workflow.
# To split the current pane horizontally:
Ctrl-b %
# To split the current pane vertically:
Ctrl-b "
# To swap the current pane with another:
Ctrl-b :swap-pane -s [source_pane] -t [target_pane]
Tmux Help and Configuration
Access help and reload your Tmux configuration.
# To display the Tmux command help (press Q to quit):
Ctrl-b ?
# To scroll within a pane (enter copy mode):
Ctrl-b [
# Use PageUp/PageDown to scroll:
PageUp/PageDown
# To reload the Tmux configuration file:
Ctrl-b : source-file ~/.tmux.conf