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 ( and Ctrl-b ) switch between tmux sessions

Tmux
~/tips/tip-tmux-switch-session

Ctrl-b ( # previous session

Moves to the previous or next tmux session without detaching first.

With a session per project you do not want to detach and attach again each time.

Ctrl-b (    # previous session
Ctrl-b )    # next session

Both keys switch the client you are using to the neighbouring session, in the order tmux ls shows them. The status bar updates to the other session name.

Press Ctrl-b s if you want a list instead. It shows all sessions and lets you pick one with the arrow keys and Enter.

From the shell, tmux switch-client -t other does the same. It only works from inside tmux, because it moves the client that is already attached.

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 it again with tmux kill-session -t scratch. Nothing else on your machine is touched.

Further reading: tmux manual page (OpenBSD, official), tmux wiki: Getting Started (official)

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