1

I'm currently using urxvt with tmux, run as such:

urxvt -e tmux

I wish to start up a completely separate instance of urxvt -e tmux (another urxvt, also running tmux) using the terminal. (More precisely, I would like a command that does so, so that I can use it in my terminal-based programs.) I can't find the right command for this, however. No matter what I try, the following error occurs:

sessions should be nested with care, unset $TMUX to force

Is there a command, or failing that an indirect method, of starting up a new urxvt -e tmux without nesting? (The second "urxvt" would have nothing to do with the first one; I just wish to trigger the spawning of a second one, also running tmux.)

Thank you.

2 Answers 2

1

All you need to do to do this is (as the error message says) unset the $TMUX variable:

(unset TMUX; urxvt -e tmux)

The subshell is necessary to avoid it being unset in your current environment, too. If you don't care about that, you don't need the subshell.

2
  • How can I tell that it's safe/unsafe to do so? (Sorry if it's a silly question, but when I looked online I kept seeing people adamant that you shouldn't be unsetting it, and should be avoiding the error instead.) Also, does it work as well for (unset TMUX; urxvt -e tmux) & May 7, 2015 at 15:33
  • @spacingissue It's safe -- nesting tmux sessions does require some care (you need to think about how to send the prefix easily to the nested sessions, for example), but there's nothing harmful about unsetting TMUX -- it's the normal way to do this. In your case, you're not even nesting. As for your question about backgrounding, yes, that will also work.
    – Chris Down
    May 7, 2015 at 15:39
0

Do not type tmux first! You need to enter your session from Linux ubuntu session. This is the problem.

So start in the Linux normal command line

and paste this below (adjust the 0 with your session name)

tmux attach-session -t 0

That is it! Problem solved. I promise. Just make sure you don't enter tmux before trying to attach a session. You must be in ubuntu/linux!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .