tmux multiple instances of the same session
I've recently converted from gnu-screen to tmux. I am struggling with 1 thing.
My workflow is something like this. I create a session for each "task" I am doing at any point in time. That way I can work on any of the N tasks I am doing by attaching to that session.
What I was able to do with screen and not being able to do with tmux is following: Having multiple instances of the same session open/attached in different windows and working on them at the same time. For example, if I am editing 3 different files, I can have them open in pane1, 2 and 3 of the same session and have each instance of the same session with those 3 files open in front of me.
I've not been able to arm-twist tmux into letting me do that. Whenever I attach to an existing attached session in tmux, it replicates the actions I take on any session on the other.
I hope I've explained this well. If not, please let me know.
Solution 1:
I think you're basically asking how to do screen -x
in tmux
? Here's an example:
# Start a new tmux session (with default session name "0").
tmux
# Start another tmux session (default name "1"), sharing windows with "0".
tmux new-session -t 0
# Start yet another tmux session (default name "2"), sharing windows with "0" (and "1").
tmux new-session -t 0
# Now you can attach to sessions with tmux attach-session -t <0|1|2>.
# Or you can omit the -t, and I think it attaches to one that isn't attached to yet.
# I don't know the exact rules for how it decides which free session to choose.
If you don't like the default numerical names when creating a new session, you can pass -s other_name
to name it something else.