Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm pretty new with Tmux. I'm looking for a way to connect a Tmux session locally to a distant one, running on my server with irssi and other stuff.

If i start a regular session with


And then connect to my serv with SSH, Tmux lost the conneciton every time i close my laptop.

In the other hand i tried to connect to my serv, starting a tmux session there, then attach o local one with

ssh myserv.com -t tmux a

But, after a AFK break i was not able to reconnect...

I'm pretty sure there is a way to do it, any clue ?

share|improve this question

2 Answers 2

You want to start your tmux session on the remote host, and just keep it running in the background. For example, run the tmux command on the remote server to start it up. Then from your local machine SSH to the server and run tmux attach -t 0 to attach to the tmux session 0.

Then when you are done, just detach the session, with a CTRL-A CTRL-D and leave it there until you need to connect again.

Make sense?

share|improve this answer
Yeah, it works. But there is no way to do it without reconnect manually ? –  x_vi_r Apr 9 '13 at 7:06
Hmm, I guess I'm not quite sure I understand what you're asking then. Maybe update your question with some more detail about your scenario. I'm guessing you will want some sort of script to do this but I need to know what you are wanting to have happen first. –  jmreicha Apr 9 '13 at 13:44

I think you need to move the '-t' part at the beginning, like this:

ssh -t myserv.com tmux attach

(inspired by: this)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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