I am quite new to tmux and don't really know how to use it to it's best effect so what I am trying to do might not be the best way of doing it. Feel free to give alternative suggestions!

The setup: I am using tmux locally on my desktop. Frequently I am connecting to a development device running ubuntu (which also has tmux installed) to run some lengthy tests.

Currently, I am simply connecting to the device via SSH in one pane in my terminal. What I would like to do is somehow connect the pane directly to a tmux session on the device (sorry if my terminology is not correct) so that I can connect and disconnect at will from lengthy tests and use the tmux configuration from my desktop. It seems to be something that tmux should be able to do, but my google-fu has failed me. Any ideas?


Not directly, since tmux simply doesn't handle the details of connecting to a remote host. However, you set up a keybinding that creates a new pane and executes your ssh command to connect to the remote host. When you disconnect, the pane automatically closes.

bind-key h split-window -h 'exec ssh user@host -t tmux -a'

Note that you now have a tmux session appearing in a pane of your local tmux session; if you use the same prefix in both, you'll need to make sure the local session has send-prefix configured (it should be by default, usually it just means pressing your prefix key twice: once to activate in the local session, the second time to send it to the remote session, after which you can press the desired key binding.)

  • Ok, thanks. When googling for it, I noticed that people seem to use tmux for pair programming. Then I assume that they need to be able to connect to each others sessions remotely. How does tmux handle the remote connections then? I haven't really understood the tmux client/server model, so I don't really get what is happening. – Leo Aug 1 '12 at 13:33
  • 1
    tmux doesn't handle the remote connection; both programmers need to be logged into the same machine, where each runs tmux to connect to a common session. – chepner Aug 1 '12 at 13:38
  • Ah, that explains it. Thanks again! – Leo Aug 1 '12 at 14:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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