How to navigate between tmux windows?

By Romain Dorgueil

Short answer

tmux next-window       # go to the next window
tmux previous-window   # go to the previous window
tmux last-window       # toggle with the previously active window

From the keyboard with the default prefix, prefix n goes to the next window, prefix p to the previous one, and prefix l (lowercase L) toggles back and forth with the window you were on before.

Details

A tmux session holds a list of windows, each with its own number. next-window and previous-window walk that list one step at a time, and they wrap: from the last window, n loops back to the first.

The one worth a reflex is prefix l, bound to last-window. It does not step through the list, it jumps straight back to the window that was active just before the current one. So when you flip to another window to check something and want to return, it is a single prefix l each way, no matter how far apart the two windows sit in the list. It is the window-level equivalent of prefix ;, which toggles the last active pane.

Verified on tmux 3.2a.

Related