How to target the right tmux pane by number?
A bare number in a tmux pane target means a pane of the current window when that pane exists, otherwise a whole window, and it flips silently. Qualify with window.pane, a pane id, or a window name.
21 articles tagged with "tmux"
A bare number in a tmux pane target means a pane of the current window when that pane exists, otherwise a whole window, and it flips silently. Qualify with window.pane, a pane id, or a window name.
Windows and panes start at 0 by default, so the leftmost one sits under a key at the far end of the keyboard. Set base-index and pane-base-index to 1 in ~/.tmux.conf so key 1 selects the first one.
The mouse is off by default. Add set -g mouse on to ~/.tmux.conf, then drag to select and copy into the tmux buffer. Hold Shift to fall back to the terminal's own selection.
Use resize-pane with -L/-R/-U/-D to push a border by N cells, or -x/-y to set an exact size. A resize only works when there is a neighbour to trade space with.
Press prefix z to expand the active pane to the whole window, and prefix z again to restore the split. Nothing closes, it is a temporary toggle.
Press prefix ; to toggle focus between the current pane and the one you were on just before, the pane-level twin of prefix l for windows.
Use prefix + arrows for directional focus, prefix o to cycle panes, and prefix q to overlay pane numbers and jump straight to one.
Use monitor-activity to flag a window when output appears, or monitor-silence to flag it when output stops, so you can watch a long job from another window.
tmux renames windows after the running program by default. Turn automatic-rename off to keep the names you set.
Repack tmux window indexes to 0, 1, 2 with move-window -r, or set renumber-windows on to do it automatically.
Swap two tmux windows with swap-window, or move one to another index with move-window.
Move between tmux windows with prefix n and p, and toggle the last two with prefix l.
Split a tmux window with split-window: -h puts panes side by side, -v stacks them top and bottom.
When one tmux runs inside another, forward the prefix with send-prefix to control the inner session.
Kill one tmux session, every session except one, or the whole tmux server.
Jump from one tmux session to another from inside tmux, without detaching and re-attaching.
List who is attached to a tmux session, grab it back from another terminal, and detach other clients.
Rename a tmux session or window from the keyboard or the shell, and keep the name you typed.
Leave a tmux session running in the background, list what is alive, and jump back in, from the keyboard or the shell.
Create a detached tmux session, name its first window, and start it in a chosen directory, all in one command.
A single idempotent tmux command that creates a session or attaches to it if it already exists. Perfect for scripts and shell startup files.