4

I have a tmux session already running. I have created it just with

tmux

now I can leave the session and re-enter with

tmux a -t 0

how can I share this session with other users? Usually one has to create the session with -S option, but I haven't. Is there a way to share my session?

marked as duplicate by Romeo Ninov, Volker Siegel, strugee, Anthon, Rui F Ribeiro Jul 16 '17 at 12:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4

You can use tmux grouped session.

First, create initial session, change its name to share:

$ tmux
$ tmux list-session
0: 1 windows (created Wed Aug 27 00:14:05 2014) [80x23] (attached)   
$ tmux rename-session -t 0 share 
$ tmux list-session
share: 1 windows (created Wed Aug 27 00:14:05 2014) [80x23] (attached)

Then, from other client, you simply add -t option and grouped session name (in this example, it's share) to tmux new-session command:

$ tmux new-session -t share -s cuonglm

-s option set the session name. If other user, i.e wiso, want to attach grouped session, he simply do:

$ tmux new-session -t share -s wiso

From man tmux:

If -t is given, the new session is grouped with target-session. This means they share the same set of windows - all windows from target-session are linked to the new session and any subsequent new windows or windows being closed are applied to both sessions. The current and previous window and any session options remain independent and either session may be killed without affecting the other. Giving -n or shell-command are invalid if -t is used.

  • session not found: share. How the new user should find the session of the first user? – wiso Aug 26 '14 at 17:32
  • @wiso: You must make an initial session, by typing tmux. Default session name 0. Other user can type tmux list-session to list all sessions. – cuonglm Aug 26 '14 at 17:34
  • the other user don't see the sessions of the first user. tmux; su; tmux list-sessions -> failed to connect to server – wiso Aug 27 '14 at 9:44
  • 1
    3 because I have other 2 sessions. No, I haven't quitted tmux, as I have said I've done control+b d, which [detach] the session, doesn't close it. – wiso Aug 28 '14 at 10:39
  • 1
    sorry, I have 3 sessions. It's not this the point. 3 is correct, I have checked with tmux ls. The point is that the second (linux) user do not see the sessions of the first user. – wiso Aug 28 '14 at 17:17

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