brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Ctrl-b l jumps back to the window you were just in

Tmux
~/tips/tip-tmux-last-window

Ctrl-b l # last window

Toggles between the current and the previous tmux window, like alt-tab for windows.

Two windows you keep switching between do not need a number each time.

Ctrl-b l     # last window
Ctrl-b L     # last session

The window you came from is marked with a dash in the status bar. Press it again and you are back.

It works like the alt-tab of window switching. Think of an editor window and a test window: you move to the test window, then back, then again. With numbers that is two keys each time, and with the last-window key it is always the same one, no matter which numbers they have.

There is a matching shortcut for sessions, Ctrl-b L, which flips to the last session you were attached to. Both remember only one step back. For anything further away, the window list with Ctrl-b w is the tool.

It remembers one window only. After a third window in between, ‘last’ is a different one.

Try it without risk: start a throwaway session with tmux new -s scratch, use the shortcut or command above there, look at what changes, and close the session again with tmux kill-session -t scratch.

Further reading: tmux manual page (OpenBSD, official), tmux wiki: Getting Started (official), On this site: Ctrl-b w shows every window of every session as a tree, On this site: Ctrl-b z zooms one pane to the whole window and brings the others back

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link