Tmux – Attach to Different Windows

I am (was) a big time GNU Screen user. Once byobu arrived, I was a big fan of that and switched to it (byobu, is basically a fancy/pretty .screenrc). Byobu shortly after made Tmux the default and I was slow in adopting the use of Tmux instead of screen. Recently though I decided to embrace Tmux for its claimed lightweight. There are a few variations which once embraced can actually be a good thing.

One use-case I use with screen, is to share a console session with other developers/sys-admins to help them or train them on performing certain tasks (kind of like a gotomeeting but on the console). This works great, except for when you have multiple windows inside a screen session, if you want to switch to another window you have to tell your colleague to switch to that window as well. This occasionally causes confusion.
Tmux on the other hand is setup slightly differently, your view of the  window groups is called a session. Therefore sharing a session means you both get to see the exact same thing all the time. This is great, BUT only for that use case.
Another use case I have is to attach to the same screen session on different terminals, so that I can have a different Gnu screen window open in either terminal. As you could guess, that doesn’t work in tmux; however there is a way. You can create a new session in tmux which is synchronized to the shell windows you have open in another session. Therefore enabling you to do this.

The following are the list of tmux commands and accepted abbreviations (PS. by default byobu is tmux, so the above commands are passed as is to tmux):
  • new-session: new, or new-s, new-se, new-ses,
  • rename-session: rename, rename-s, rename-se…
  • attach-session: a, at, att…, attach, attach-, attach-s…
  • kill-session: kill-s, kill-se…
Sources: