Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a pretty simple tmux session running with two open windows; one of them for local hacking and one of them for work.

What I'd like to do is to simply connect to the hacking window while leaving the work window open in another terminal. However, as soon as I connect to tmux, all commands are sent to both windows, so if I switch to another window, the same thing happens in the other terminal and vice-versa.

Is there a way for me to simply connect to each window separately?

share|improve this question
up vote 91 down vote accepted

The reason both clients switch windows at the same time is because they are both connected to the same session (the “current window” is an attribute of the session, not the client). What you can do is link one or more windows into multiple different sessions. Since each session has its own “current window”, you can then switch windows independently in each session.

The easiest way to use this feature is to use the “grouped sessions” feature of the new-session command:

tmux new-session -t 'original session name or number'

Each session in a group will automatically share the same set of windows: opening/linking (or closing/unlinking) a window in one session of the group automatically causes the same window to be linked (or unlinked) in all the other sessions of the group.

When you are done with your “extra” session, you can kill it with kill-session. The windows themselves will not be killed unless your session was the only one they were linked to. Alternatively, you can disconnect from your “extra” session like normal (Prefix d, or detach-client); if you do keep your “extra” session around (by simply detaching from it), you might want to give it a descriptive name (Prefix $, or rename-session) so that you easily identify it and reconnect to it later (you may also want to give the “original” session a name, too).

If you do not want to automatically share a dynamic set of windows, then you can use link-window (and unlink-window) to bring individual windows into (and out of) your own “personal” session; this offers non-automatic, and lower-level access to the same core functionality upon which “grouped sessions” are based (windows linked into multiple sessions).

share|improve this answer
Gread answer. Do you know how to prevent 2 open sessions from syncing their sizes? If I'm creating new session and the window is smaller, a lot of screen real estate in the original one is wasted. – Artem Ice Mar 23 '13 at 11:25
I've found the answer to my Q: setw -g aggressive-resize on – Artem Ice Mar 23 '13 at 12:35
This was exactly what I needed - so damn good. Tmux is just awesome. I was able to go between 2 big displays and a laptop with this. Thanks – drudru Nov 7 '13 at 6:48
Thank you so much. I was stuck in it for a while. Love tmux! – Rocky Jan 1 '14 at 8:47
This is supported as "rogue" mode in wemux. – blueyed Oct 14 '15 at 11:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.