Working with tmux on linux
24-05-2026
Hierarchy:
- server -> sessions -> windows -> panes
- server: one background process per user (holds all sessions)
- session: a workspace
- window: a tab inside a session (each window has independent layout of panes)
- pane: a single shell
Idiomatic Usage:
- one session per project (not per terminal); attach and detach
- one window per task / concern
- panes are ephemeral; they can be splitted and short-lived
- reattach, don’t restart
- use a plugin like tmux-resurrect to persist state
- let tmux own multiplexing; don’t nest tmux inside tmux over SSH
Installation:
- installation guide for RHEL
Shortcuts
- shortcut prefix =
Ctrl-b(press, release, press other combinations)
Sessions:
- tmux new -s NAME — new named session
- tmux ls — list sessions
- tmux a / tmux a -t NAME — attach
- prefix d — detach
- prefix s — pick a session interactively
- prefix $ — rename current session
Windows:
- prefix c — create window
- prefix , — rename window
- prefix n / prefix p — next / previous
- prefix 0..9 — jump to window N
- prefix w — interactive window picker
- prefix & — kill window
Panes:
- prefix % — split vertical (left/right)
- prefix ” — split horizontal (top/bottom)
- prefix arrow — move between panes
- prefix z — zoom current pane fullscreen (toggle)
- prefix x — kill pane
- prefix { / prefix } — swap pane order
- prefix space — cycle through layouts
Misc:
- prefix : — command prompt (e.g. :source-file ~/.tmux.conf to reload)
- prefix ? — list all key bindings
Custom bindings (no prefix needed):
- Alt-t — new window in ~/code/ia-ai
- Alt-h / Alt-v — split horizontal / vertical
- Alt-arrows — move between panes
- Alt-Shift-←/→ — previous / next window
- Alt-w — kill current pane
Configuration
- define inside a
~/.tmux.conf
# ---------- General ----------
set -g mouse on
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
set -g history-limit 50000
set -s escape-time 10 # avoid Esc lag affecting Alt-bindings
# ---------- Visuals (mirror WezTerm) ----------
# Red pane borders, like colors.split = '#ff0000'
set -g pane-border-style "fg=red"
set -g pane-active-border-style "fg=red,bold"
# Dim inactive panes, like inactive_pane_hsb { brightness=0.4, saturation=0.4 }
set -g window-style "fg=colour245"
set -g window-active-style "fg=default"
# ---------- Splits (Alt+h / Alt+v) ----------
bind -n M-h split-window -h -c "#{pane_current_path}" # new pane to the right
bind -n M-v split-window -v -c "#{pane_current_path}" # new pane below
# ---------- Pane navigation (Alt+arrows) ----------
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# ---------- Close current pane (Alt+w) ----------
bind -n M-w kill-pane
# ---------- Window navigation (Alt+Shift+arrows) ----------
bind -n M-S-Left previous-window
bind -n M-S-Right next-window
# ---------- New window in the ia-ai repo (Alt+t) ----------
bind -n M-t new-window -c "/home/admlmiloszewski/code/ia-ai"
# ---------- Pane-aware mouse copy via OSC 52 ----------
set -g set-clipboard on
bind -T root MouseDrag1Pane if -F -t = "#{mouse_any_flag}" \
"if -Ft= '#{pane_in_mode}' 'copy-mode -M' 'send-keys -M'" \
"copy-mode -M"
bind -T copy-mode MouseDragEnd1Pane send -X copy-pipe-no-clear
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-no-clear