Tmux Commands Reference
Introduction to Tmux
Tmux (Terminal Multiplexer) is a powerful terminal multiplexer for Unix-like operating systems.
It allows you to manage multiple terminal sessions from a single window, enhancing your command-line productivity.
Basic Tmux Commands
| Description | Command | 
|---|
| Start a new session | $ tmux
  | 
| Start a new named session | $ tmux new -s myname
  | 
| Show all sessions | $ tmux ls
  | 
| Attach to the last session | $ tmux a
  | 
| Attach to a named session | $ tmux a -t myname
  | 
| Kill a session by name | $ tmux kill-ses -t myname
  | 
| Kill all sessions except the current | $ tmux kill-ses -a
  | 
| Kill all sessions except 'myname' | $ tmux kill-ses -a -t myname
  | 
| Reload Tmux configuration | $ tmux source-file ~/.tmux.conf
  | 
| Show global Tmux options | $ tmux show-options -g
  | 
| Display Tmux server information | $ tmux info
  | 
Tmux Copy Mode
Copy mode in Tmux allows you to select and copy text from your terminal buffer.
It mainly works like selecting text in Vim.
| Shortcut | Description | 
|---|
Ctrl+b [ | Enter copy mode | 
Space | Start selection | 
Enter | Copy selection | 
q | Quit copy mode | 
Ctrl+b ] | Paste contents of buffer_0 | 
Essential Tmux Shortcuts
Getting Started with Shortcuts
| Shortcut | Description | 
|---|
Ctrl+b ? | List all shortcuts | 
Panes (Splits)
| Shortcut | Description | 
|---|
Ctrl+b " / % | Split Horizontally / Vertically | 
Ctrl+b ! | Move pane to a new window | 
Ctrl+b x | Kill current pane | 
Ctrl+b <Arrow> | Navigate panes | 
Ctrl+b Space | Toggle pane layouts | 
Ctrl+b { / } | Move current pane Left / Right | 
Ctrl+b o | Go to next pane | 
Ctrl+b z | Toggle full-screen for current pane | 
Ctrl+b ; | Toggle to last active pane | 
Ctrl+b q | Show pane numbers | 
Ctrl+b q 0...9 | Go to pane number | 
Windows (Tabs)
| Shortcut | Description | 
|---|
Ctrl+b c | Create new window | 
Ctrl+b p / n | Previous / Next window | 
Ctrl+b " / % | Split Horizontally / Vertically (within window) | 
Ctrl+b w | List all windows | 
Ctrl+b , | Rename current window | 
Ctrl+b f | Find window by name | 
Ctrl+b l | Go to last active window | 
Ctrl+b . | Move current window | 
Ctrl+b & | Close current window | 
Ctrl+b 0...9 | Go to window number | 
Sessions (Set of Windows)
| Shortcut | Description | 
|---|
Ctrl+b d | Detach from current session | 
Ctrl+b s | Show all sessions | 
Ctrl+b $ | Rename current session | 
Ctrl+b ( / ) | Previous / Next session | 
Tmux Command Mode
Enter command mode by pressing Ctrl+b :.
This allows you to type Tmux commands directly.
Command Mode Usage
| Shortcut | Description | 
|---|
Ctrl+b : | Enter command mode | 
Resizing Panes (Command Mode)
| Command | Description | 
|---|
resize-pane -D 20 | Resize pane down by 20 units | 
resize-pane -U 20 | Resize pane up by 20 units | 
resize-pane -L 20 | Resize pane left by 20 units | 
resize-pane -R 20 | Resize pane right by 20 units | 
Listing Information (Command Mode)
| Command | Description | 
|---|
list-keys | List all key bindings | 
list-panes | List all panes | 
list-windows | List all windows | 
Copying and Buffers (Command Mode)
| Command | Description | 
|---|
list-buffers | List all paste buffers | 
show-buffer | Show contents of buffer #0 | 
capture-pane | Copy current pane's content to buffer | 
choose-buffer | Show and paste from selected buffer | 
save-buffer a.txt | Save buffer contents to a file | 
delete-buffer -b 1 | Delete buffer number 1 | 
Setting Options (Command Mode)
| Command | Description | 
|---|
set -g OPTION | Set global option for all sessions | 
setw -g OPTION | Set global option for all windows | 
setw -g mode-keys vi | Enable vi-mode for copy mode | 
set -g prefix C-a | Set prefix key to Ctrl+a | 
Miscellaneous Commands
| Command | Description | 
|---|
swap-pane -s 3 -t 1 | Swap pane 3 with pane 1 | 
swap-window -t -1 | Move current window to the left | 
setw synchronize-panes | Toggle synchronized input across panes | 
join-pane -t :# | Join pane to target window/pane |