Session Command Reference
All commands run from an external shell (no prefix needed). Equivalent Ctrl+b : commands omit the tmux prefix.
Session Commands
# Create
tmux new-session -s name # new named session
tmux new -s name -n window-name -d # named, initial window, detached
# List
tmux ls
tmux list-sessions
# Attach
tmux attach -t name
tmux a -t name
tmux attach # most recent
# Detach (from inside)
# Ctrl+b d
# Rename
tmux rename-session -t oldname newname
# Kill
tmux kill-session -t name
tmux kill-session -a # kill all except current
tmux kill-server # kill everything
Window Commands
# Create
tmux new-window -t session -n name
tmux new-window -t session:3 -n name # at specific index
# Rename
tmux rename-window -t session:index name
# Kill
tmux kill-window -t session:index
# Move
tmux swap-window -s 1 -t 3
tmux move-window -t 0
# Select
tmux select-window -t session:name
Pane Commands
# Split
tmux split-window -h -t session:window # vertical (side by side)
tmux split-window -v -t session:window # horizontal (top/bottom)
tmux split-window -h -c "#{pane_current_path}" # same directory
# Select
tmux select-pane -t session:window.index
tmux select-pane -L/-R/-U/-D # by direction
# Kill
tmux kill-pane -t session:window.index
# Swap
tmux swap-pane -s 0 -t 1
# Zoom
tmux resize-pane -Z -t session:window.pane
# Resize
tmux resize-pane -L/-R/-U/-D 5 # by cells
Send-Keys
# Send text to a pane
tmux send-keys -t session:window.pane "command" Enter
# Send control key
tmux send-keys -t session:window.pane "C-c" ""
# Send to current pane
tmux send-keys "ls -la" Enter
Environment and Config
# Show all sessions
tmux ls
# Source config
tmux source-file ~/.tmux.conf
# Show global options
tmux show-options -g
# Show window options
tmux show-window-options -g
# Show environment
tmux show-environment
# Set environment variable
tmux set-environment VAR value
# List key bindings
tmux list-keys
Buffer Commands
tmux list-buffers # list all paste buffers
tmux show-buffer # show last buffer
tmux save-buffer file.txt # save buffer to file
tmux load-buffer file.txt # load file to buffer
tmux delete-buffer -b 0 # delete specific buffer