11

Over time, I become invested in my terminal sessions: tabs, command history, window layout and title, etc. Eventually, a reboot requires me to start all over again which wastes my time.

The two terminal emulators with which I'm familiar had at least partial capability here, but the functionality has since been removed: konsole lost this functionality somewhere along the way to KDE4. gnome-terminal lost the --save-config option as "obsolete" somewhere before version 3.10.2, i.e. the answer here no longer applies: Save multiple gnome-terminal layout?

I want to capture the current state of all terminal sessions and restore them after a reboot. A scripted solution would be fine, so long as it does not require manual updates to track session changes.

srking
  • 211

6 Answers6

2

this isn't exactly what you asked for but tmux has such capabilities.

Just make sure to install the tmux-resurrect plugin along with it, which allows for restoring the tmux environment (windows, splits, and certain running programs) after a restart.

On the bright side, tmux will work with all

glallen
  • 2,244
sgp667
  • 751
1

Here is an xfce terminal fork, with possibility to save/restore session just from menu: https://github.com/repu1sion/xfce4-terminal

pulse
  • 111
1

https://github.com/Eugeny/terminus saves open tabs & remembers the correct directory for each

Marius
  • 111
1

The excellent Guake Terminal allows you to do this, there is an option to remember your set of tabs between restarts.

It's currently listed as an 'experimental' feature in the settings, but after using this feature for a few months, I've never had a problem.

oli
  • 11
1

I guess that this is not really an answer to your question, but this is how I had it set up:

A bunch of scripts which would open different "Gnome-Terminal presets".

For example, in this script, I open gnome-terminal with three tabs, and call SSH with parameters in each one.

#!/bin/sh
PATH=/usr/bin:/bin 

gnome-terminal \
--tab -t CustomTabText1 -e 'sh -c "ssh hostname.one"' \
--tab -t CustomTabText2 -e 'sh -c "ssh hostname.two"' \
--tab -t CustomTabText3 -e 'sh -c "ssh hostname.three"'

I also used ssh config file heavily to reflect specific host SSH parameters. Of course, if you need an exception, just pass the parameters to SSH in the gnome-terminal script, which will take precedence over the SSH config file.

Kaurin
  • 750
0

Now with vscode extension Terminal Keeper you can customize your saved terminal sessions with json config like

 "default": [
            [
                {
                    "name": "docker:ros",
                    "commands": [
                        "ssh r99"
                    ],
                    "autoExecuteCommands": true
                },
                {
                    "name": "docker:k8s",
                    "commands": [
                        ""
                    ]
                },
                {
                    "name": "docker:nats",
                    "commands": [
                        ""
                    ]
                },
                {
                    "name": "docker:fleet",
                    "commands": [
                        ""
                    ]
                }
            ],
            [
                {
                    "name": "db:postgre",
                    "commands": [
                        ""
                    ]
                },
                {
                    "name": "db:redis",
                    "commands": [
                        ""
                    ]
                },
                {
                    "name": "db:hyper",
                    "commands": [
                        ""
                    ]
                },
                {
                    "name": "db:mysql",
                    "commands": [
                        ""
                    ]
                }
            ],
            [
                {
                    "name": "api:delivery",
                    "commands": [
                        ""
                    ]
                },
                {
                    "name": "api:feedback",
                    "commands": [
                        ""
                    ]
                },
                {
                    "name": "api:service",
                    "commands": [
                        ""
                    ]
                }
            ],
            {
                "name": "test",
                "commands": [
                    ""
                ]
            },
            {
                "name": "debug",
                "commands": [
                    ""
                ]
            }
        ],

pretty easily.

xgdgsc
  • 1,630