If using terminal multiplexer screen, one can easily attach a session which is not detached with
screen -x
That way it is possible to attach the same session to multiple clients. By default you are able to view different screen windows per client which attached that session.
In tmux the default behavior differs. Though you can also attach the same tmux session to multiple clients e.g. with
tmux attach-session
it will let you view the same tmux window in all clients that attached that tmux session. When tmux instance starts it creates automatically one tmux session. Such a session is presented equally to every client.
Create independend tmux sessions for the same window set
A user creates a new tmux session with
user@clientA$ tmux new-session
## create some more windows
## work
The user decides to work with the same window set in another terminal independend:
user@clientB$ tmux list-sessions
0: 8 windows (created Tue Dec 13 20:55:56 2011) [136x49] (group 0) (attached)
user@clientB$ tmux new-session -t 0
That creates a new session which uses the same window set as group 0 listed above and attaches clientB to it. Two independent sessions working on the same set of windows are running. Very close to screen behavior.
Output of tmux list-sessions looks now like:
0: 8 windows (created Tue Dec 13 20:55:56 2011) [136x49] (group 0) (attached)
1: 8 windows (created Wed Dec 14 21:53:44 2011) [101x33] (group 0) (attached)
While attached to a tmux session tmux lets you change your session interactively with <C-b s>. Closing sessions is done e.g. by
tmux kill-session -t <sessionnumber>