How to jump back to the last active tmux pane?

By Romain Dorgueil

Short answer

tmux last-pane        # toggle back to the previously active pane
tmux select-pane -l   # same toggle from the CLI

From the keyboard, prefix ; runs last-pane. It toggles focus between the current pane and the one you were on just before, so jumping to a pane and back is one keystroke each way.

Details

last-pane remembers the previously active pane in the current window and swaps focus to it. Run it again and you are back where you started, which makes it perfect for going back and forth between two panes (editor and shell, logs and code) without aiming with arrows or pane numbers.

It is the pane-level twin of prefix l (lowercase L), which toggles the last active window. The CLI equivalent is select-pane -l. If the pane you left was zoomed, add -Z (last-pane -Z) to keep it zoomed across the toggle instead of dropping back to the tiled view.

The “last” pane is tracked per window, so the toggle only ever moves you inside the current window; it will not pull focus to a pane in another window.

Verified on tmux 3.2a: with two panes and pane 0 focused, last-pane moves focus to pane 1, and running it again returns focus to pane 0. The default bind prefix ; maps to last-pane.

Related