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, Ctrl-A n goes to the next window, Ctrl-A p to the previous one, and Ctrl-A 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 Ctrl-A 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 Ctrl-A l each way, no matter how far apart the two windows sit in the list. It is the window-level equivalent of Ctrl-A ;, which toggles the last active pane.

Verified on tmux 3.2a.

Want to work together? Get in touch.

Related