| name | tmux |
| description | Terminal multiplexer mastery for sessions, windows, panes, and scripting. Use when user asks to "set up tmux", "split terminal", "tmux keybindings", "create tmux session", "tmux config", "tmux script", or any terminal multiplexing tasks. |
tmux
Terminal multiplexing for sessions, windows, and panes.
Sessions
tmux new -s dev
tmux new-session -s dev
tmux ls
tmux list-sessions
tmux attach -t dev
tmux a -t dev
tmux kill-session -t dev
tmux rename-session -t old new
Windows (Tabs)
Panes (Splits)
Copy Mode
Command Mode
:new-window -n "editor"
:split-window -h
:resize-pane -D 10
:swap-pane -D
:setw synchronize-panes on
:setw synchronize-panes off
Scripting
#!/bin/bash
SESSION="dev"
tmux new-session -d -s $SESSION -n "editor"
tmux send-keys -t $SESSION:editor "vim ." Enter
tmux new-window -t $SESSION -n "server"
tmux send-keys -t $SESSION:server "npm run dev" Enter
tmux new-window -t $SESSION -n "test"
tmux split-window -h -t $SESSION:test
tmux send-keys -t $SESSION:test.0 "npm test -- --watch" Enter
tmux send-keys -t $SESSION:test.1 "tail -f logs/app.log" Enter
tmux new-window -t $SESSION -n "git"
tmux send-keys -t $SESSION:git "git status" Enter
tmux select-window -t $SESSION:editor
tmux attach -t $SESSION
.tmux.conf
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set -g mouse on
set -g base-index 1
setw -g pane-base-index 1
setw -g mode-keys vi
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind r source-file ~/.tmux.conf \; display "Reloaded!"
set -g status-style 'bg=#333333 fg=#ffffff'
set -g status-left ' #S '
set -g status-right ' %H:%M '
set -g history-limit 50000
-sg escape-time 0
-g default-terminal
-ga terminal-overrides
setw -g automatic-rename on
-g renumber-windows on
Quick Reference
Prefix = Ctrl-b (default) or Ctrl-a (if remapped)
Sessions: d=detach s=list $=rename (/)=prev/next
Windows: c=new ,=rename n/p=next/prev 0-9=switch &=kill
Panes: "=hsplit %=vsplit arrows=navigate z=zoom x=kill
Copy: [=enter Space=select Enter=copy ]=paste
Command: :=prompt
Reference
For .tmux.conf customization: references/config.md