Skip to content

How to restore from command line when starting tmux? #139

@mgraham

Description

@mgraham

Ok, maybe I'm doing it wrong, but...

To restore a session from the bash prompt (after a fresh reboot), I run:

$ tmux new-session

Then I hit prefix ctrl-r

This restores all of my windows, but it also leaves me with the 'extra' window that was created with new-session.

I kill the new window. This drops me out of tmux and back to the bash prompt. Then I have to run

$ tmux attach

Now I'm finally in my restored session without the extra new-session window.

Is there any way to do all of this in one step? I'd love to have a bash script that does the following:

  • attaches to a tmux session if it is running
  • restores the saved session if no session is running

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions