How to remember multiple tabs' session in terminal? (Alike FF session manager)
Asked Answered
T

4

13

how does one "undo close-tab" in terminal? And quite related to it, is it possible to remember a session of tabs in terminal?

I mean (alike Firefox) if I close all tabs in a particular terminal window, how do I open with same the next day?

Its really useful to remember the terminal session for people like me who use multiple tabs a lot, and do not wish to start the next day with remembering what (and whereall) one was working, when one left the desk the day before.

In mouse right-click menu of gnome-terminal, one could easily (and I have) mistakenly click close tab instead of 'Copy'and lost track of what and where one was before selecting the text selected. In this case, undo closed-tab will serve a great purpose (available in Firefox already)

Thanks!

--V

Tu answered 18/5, 2011 at 17:14 Comment(0)
B
7

For the gnome terminal, you can use

gnome-terminal --profile=〈your profile〉 --save-config=〈file〉

I launch it as a background task to save the terminal state periodically.

Baerman answered 1/5, 2012 at 10:45 Comment(3)
Hi! I tried this, and got the following error! Any comments? gnome-terminal --profile=Default --save- config=~/.terminal.save.test Failed to forward arguments: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dfile_2derror_2dquark.Code4: Failed to create file '/work/bkp.aka/organic/~/.terminal.save.test.S9BJXW': No such file or directoryTu
@Tu - just tested on Ubuntu 11.04, GNOME Terminal 2.32.1, and the problem is use of tilde ~ in the arguments; note that it expands both to your home dir and an extra tilde in /work/bkp.aka/organic/~/.... I got the same error when I used the tilde, but using a full path instead: gnome-terminal --profile=mini --save-config=/home/username/.terminal.save.test worked fine for me, and config file gets saved. Also, --profile in this version is not listed in --help, but it works (when starting, not for saving config). Hope this helps - cheers!Anthill
For gnome-terminal 3.6.2 on Ubuntu 14.04, --profile has no affect, that is --save-config works as though --profile was not given..Cm
T
6

"termit" can save sessions and is scriptable in lua: https://github.com/nonstop/termit/wiki I don't know about an "undo close tab" feature, though.

For reference, my termit lua config can be found here: https://github.com/thet/dotfiles-termit

Touraco answered 10/1, 2014 at 1:38 Comment(0)
T
6

On Linux, gnome-terminal is able to load multiple tabs with different working directories. Like termit (which is much more flexible due to it's lua scripting interface), it doesn't have a "undo close tab" feature.

Open Gnome terminal with multiple tabs, each one in another working directory: gnome-terminal --tab --working-directory=/home --tab --working-directory=~ --tab --working-directory=/opt.

Open Gnome terminal with multiple tabs and one base working directory: gnome-terminal --working-directory=/home --tab --tab --tab.

For more options do: gnome-terminal --help-all.

Touraco answered 21/2, 2017 at 1:24 Comment(0)
R
3

The gnome terminal doesn't have such features, but if you're open to change you could try konsole, it has some nice 'save session' options you could find helpful, though nothing about re-opening accidentally closed tabs, as far as I know.

The other thing, if you're particular about your desktop, is that KDE's konsole might not fit all too well within Gnome.

Ripieno answered 18/5, 2011 at 21:49 Comment(1)
Konsole dropped the 'save session' feature in recent versions. What you now have is the command option --tabs-from-file. It allows you to define multiple tabs with specific title, workdir, command and shell profile in a file. Check the Command-line Options sections of the Konsole docs for an example and specs.Sherbrooke

© 2022 - 2024 — McMap. All rights reserved.