Question

Is it possible to export/import tmux sessions?

At the university we have identical machines (same binaries and file structure) and sometimes I want to move a tmux session from one machine to another. Is there a way to do this?

Was it helpful?

Solution

As pointed on the comments, it is very unlikely that you would be able to restore all the state of tmux session.

If your purpose is to access the tmux session from a different machine (hostB), while the tmux session is still running on the original machine (hostA), you could simple access it through ssh:

hostB $ ssh hostA
hostA $ tmux attach

The link you mentioned contains a discussion about how to re-create a tmux session. If you are interested in starting a similar tmux session, you should try tmuxinator:

# ~/.tmuxinator/sample.yml    
name: sample
root: ~/
windows:
  - editor:
      layout: main-vertical
      panes:
        - vim
        - guard
  - server: ssh serverX
  - logs: tail -f log/development.log

By issuing mux start sample you will have a tmux session with three windows:

  • the first with two panes, the first one running vim
  • the second with a ssh to a given server
  • the third displaying the tail of a log file

Using this file you could start similar sessions on different machines.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top