How to switch between tmux sessions without detaching?
• By Romain Dorgueil
Short answer
tmux switch-client -t other # jump the current client to session 'other'
From the keyboard:
prefix ( # switch-client -p : previous session
prefix ) # switch-client -n : next session
prefix L # switch-client -l : last used session (toggle)
Details
You do not need to detach to change session. detach then attach -t other works, but it drops
you to the shell in between. switch-client moves the attached client straight to another session,
staying inside tmux the whole time.
From the shell or the command prompt, tmux switch-client -t name targets a session by name. The
keyboard binds cover the common moves without typing a name: prefix ( and prefix ) walk to the
previous and next session in order, and prefix L toggles back to the last session you used, the
session equivalent of last-window.
If you want a picker instead of stepping one by one, prefix s opens choose-tree -Zs, the
interactive session tree.
Verified on tmux 3.2a.