Cheatsheet Pages / tmux Cheatsheet
How to reorder tmux windows — swap-window and move-window
Your windows are in the wrong order, or a number gap appeared that you want to close.
tmux's default prefix is Ctrl-b: “prefix c” means press Ctrl-b, let go, then press c. Every CLI command was run for real against tmux 3.4 in detached test sessions, and every prefix binding was checked against the default binding table.
tmux swap-window -s work:1 -t work:3 # swap the positions of windows 1 and 3
tmux move-window -s work:1 -t work:5 # move window 1 to index 5 (must be empty)
# inside tmux: prefix . prompts for a target index and moves the current window there
