Hacker News new | ask | show | jobs
by gdiocarez 4500 days ago
Does anyone know how to save/ retrieve sessions?
7 comments

Depending on your meaning:

   $ tmux detach

   $ tmux attach
This will deattach and reattach a tmux session. You can type ``tmux detach`` inside a tmux pane of the session you want to detach. Also the key combo ``Ctrl-b d`` will detach.

If you mean a way to save the workspace configuration, tmuxp, teamocil and tmuxinator are great solutions.

(Note, I wrote tmuxp as a python project a few months ago.)

I use tmuxinator[0] to manage it. [0]: https://github.com/tmuxinator/tmuxinator
RTFM.
The one downside to tmux over screen is that tmux basically requires that all clients connecting to it have the same screen size, and by default it chooses the smallest one. So while you can connect to an existing session, the output might be ugly.

For this reason, I typically simply 'tmux detach;tmux attach"

tmux a -d will attach and also detach all other clients.
Tmuxifier (https://github.com/jimeh/tmuxifier) is a great utility for scripting tmux layouts. Well worth checking out if you have complex layouts you want to be able to recreate.

    tmux new -s session_name
    
Then to reattach

    tmux attach -t session_name
Read it as "tmux, attach to session_name"

Forget which sessions you have open? List them out!

    tmux ls
Leader-d should detach your session safely. "tmux ls" will list running sessions, and "tmux attach -t session-name" will connect you to session-name.