Ultimate tmux Cheatsheet: Master Terminal Multiplexing
Starting tmux
tmux
: Start a new sessiontmux new -s <session-name>
: Start a new session with a specific nametmux attach
: Attach to the last used sessiontmux attach -t <session-name>
: Attach to a specific session by nametmux ls
: List all sessions
Session Management
tmux kill-session -t <session-name>
: Kill a specific sessiontmux switch -n
: Switch to the next sessiontmux switch -p
: Switch to the previous sessiontmux rename-session <new-name>
: Rename the current session
Window Management
tmux new-window
: Create a new windowtmux select-window -t <window-id>
: Select a specific window by IDtmux rename-window <new-name>
: Rename the current windowtmux kill-window
: Kill the current window
Pane Management
tmux split-window
: Split the current pane horizontallytmux split-window -v
: Split the current pane verticallytmux select-pane -t <pane-id>
: Select a specific pane by IDtmux swap-pane -s <source-id> -t <target-id>
: Swap two panestmux kill-pane
: Kill the current panetmux resize-pane -D
: Resize pane downtmux resize-pane -U
: Resize pane uptmux resize-pane -L
: Resize pane lefttmux resize-pane -R
: Resize pane right
Key Bindings
Ctrl-b :new-session
orCtrl-b :new
: Create a new sessionCtrl-b s
: List sessionsCtrl-b (
: Switch to the previous sessionCtrl-b )
: Switch to the next sessionCtrl-b $
: Rename the current sessionCtrl-b d
: Detach from the current sessionCtrl-b c
: Create a new windowCtrl-b ,
: Rename the current windowCtrl-b l
: Switch to the last windowCtrl-b n
: Switch to the next windowCtrl-b p
: Switch to the previous windowCtrl-b 0
toCtrl-b 9
: Switch to the window by indexCtrl-b .
: Move the current window to a new indexCtrl-b &
: Kill the current windowCtrl-b %
: Split the current pane verticallyCtrl-b "
: Split the current pane horizontallyCtrl-b x
: Kill the current paneCtrl-b o
: Switch to the next paneCtrl-b ;
: Switch to the previously active paneCtrl-b q
: Show pane numbers (press the number key to switch to that pane)Ctrl-b {
: Swap the current pane with the previous paneCtrl-b }
: Swap the current pane with the next paneCtrl-b !
: Move the current pane to a new windowCtrl-b z
: Toggle pane zoomCtrl-b Ctrl-Up
: Resize the current pane upCtrl-b Ctrl-Down
: Resize the current pane downCtrl-b Ctrl-Left
: Resize the current pane leftCtrl-b Ctrl-Right
: Resize the current pane rightCtrl-b Up
: Move to the pane above the current paneCtrl-b Down
: Move to the pane below the current paneCtrl-b Left
: Move to the pane to the left of the current paneCtrl-b Right
: Move to the pane to the right of the current paneCtrl-b [
: Enter copy modeCtrl-b ]
: Paste the most recent bufferCtrl-b =
: List paste buffersCtrl-b -
: Delete the most recent bufferCtrl-b t
: Show the time in the current paneCtrl-b ?
: List all key bindingsCtrl-b :
: Open the command promptCtrl-b #
: Open the buffer listCtrl-b L
: Switch the layout of panes (even-horizontal, even-vertical, main-horizontal, main-vertical)
Copy Mode
Space
: Begin selectionEnter
: Copy the selected textv
: Select text verticallyV
: Select the entire liney
: Copy to the system clipboard (requires xclip or pbcopy)/
: Search forward?
: Search backwardn
: Search nextN
: Search previous
Miscellaneous
tmux list-commands
: List all tmux commandstmux list-keys
: List all key bindingstmux info
: Show information about the current sessiontmux setw -g monitor-activity on
: Notify when there is activity in another windowtmux setw -g monitor-silence 30
: Notify when a window has been silent for 30 secondstmux set -g mouse on
: Enable mouse support (scrolling, selecting panes, etc.)
Configuration
The configuration file for tmux is .tmux.conf
, which is typically located in the user’s home directory. You can customize your tmux experience by adding various commands and options to this file. Here is an overview of some configuration options and examples:
General Settings
set -g
: Set a session option globallysetw -g
: Set a window option globallybind-key
: Create a custom key bindingunbind-key
: Remove an existing key binding
Appearance
set -g status-style bg=<color>,fg=<color>
: Set the status bar background and foreground colorsset -g status-left <string>
: Set the left side of the status barset -g status-right <string>
: Set the right side of the status barsetw -g window-status-format <string>
: Set the format for the window listsetw -g window-status-current-format <string>
: Set the format for the current window in the listset -g pane-border-style fg=<color>,bg=<color>
: Set the pane border colorsset -g pane-active-border-style fg=<color>,bg=<color>
: Set the active pane border colorsset -g message-style bg=<color>,fg=<color>
: Set the message bar colors
Behavior
setw -g mode-keys vi
: Use vi key bindings in copy modeset -g history-limit <number>
: Set the maximum number of lines in the scrollback bufferset -g mouse on
: Enable mouse support (scrolling, selecting panes, etc.)set -g prefix2 <key>
: Set an additional prefix keyset -g base-index <number>
: Set the base index for windows (e.g., 1 to start with the first window at index 1)setw -g pane-base-index <number>
: Set the base index for panessetw -g automatic-rename on
: Automatically rename windows based on the current running command
Custom Key Bindings
Add these lines to your .tmux.conf
file to create custom key bindings:
bind-key -n F11 resize-pane -U 5
: Resize pane up by 5 cells without the prefix key (Ctrl-b)bind-key -n F12 resize-pane -D 5
: Resize pane down by 5 cells without the prefix key (Ctrl-b)bind-key C-s setw synchronize-panes on
: Synchronize input across all panes withCtrl-b C-s
bind-key C-u setw synchronize-panes off
: Disable pane synchronization withCtrl-b C-u
{
"seed": 3829226,
"used_random_seed": true,
"negative_prompt": "worst quality, low quality, child, blurry, deformed, disfigured, morbid, mutated, bad anatomy, bad art",
"num_outputs": 1,
"num_inference_steps": 100,
"guidance_scale": 7.5,
"width": 512,
"height": 512,
"vram_usage_level": "high",
"sampler_name": "euler",
"use_stable_diffusion_model": "neverendingDreamNED_bakedVae",
"use_vae_model": "vae-ft-mse-840000-ema-pruned",
"stream_progress_updates": true,
"stream_image_progress": false,
"show_only_filtered_image": true,
"block_nsfw": false,
"output_format": "jpeg",
"output_quality": 75,
"metadata_output_format": "json",
"original_prompt": "Master Terminal Multiplexing, deepleaps.com, 4k, 8k, ultra highres, raw photo in hdr, sharp focus, intricate texture",
"active_tags": [],
"inactive_tags": [],
"use_upscale": "RealESRGAN_x4plus",
"upscale_amount": "4",
"use_lora_model": "",
"use_face_correction": "GFPGANv1.3",
"prompt": "Master Terminal Multiplexing, deepleaps.com, 4k, 8k, ultra highres, raw photo in hdr, sharp focus, intricate texture",
"use_cpu": false
}