How to remember multiple tabs' session in terminal? (Alike FF session manager) - linux

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

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.

"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

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.

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.

Related

Sending the same command to many opened Konsole sessions and tabs

I have a linux machine with KDES.
I have many Konsole sessions opened. Each one has few opened tabs.
Occasionally, I'm changing some basic configuration such as adding alias or altering a bit the prompt. In that case, I would like to update all the opened shells about it. Such as sending "source ~/.aliases" to all of the shells.
I have found tmux, but it create its own arrangement of windows. I however, want to use the already existing arrangement of konsole windows.
I also found qdbus, but those commands seem to works only on the current konsole and not other konsole processes.
Any help will be appreciated.

Using console as tab

I have several cpp source files in tabs in vim. I would like to have another tab with command prompt in order to run make. I open net tab , run sh and now I have console. But how to move from this console to other tabs? If I press ctrl+page up I have garbage in console and no tab change. How to move to another text tab when staying in console tab?
As I said, vim 8 or neovim both have an terminal emulator in it.
Since you are using vim 7 here are some other ways:
Tmux as #wizzup mentioned is perfect for this use-case. I think it is the most used Terminal-Multiplexer and extremly mighty. It is complex in comparison but since you are using vim, a steep learning curve should not be a killer point. However there are a few cavehats but you will find thousands of articles to solve them.
GNU Screen is an alternative to tmux, I have no experience with it, but should be usable pretty good with vim too.
With them you can use something like this Plugin which allows you to use the terminal in vim itself. However I haven't tested it but it seems to be rather groomed.

How to Split Screen Emacs and Terminal

everyone.
I use PuTTY and I am wondering if it's possible to open an emacs text file in split screen with the terminal window.
I looked everywhere for the answer, but all I've found is how to have two emacs windows open, and I would like to be able to see and switch between the terminal window and an emacs file.
Thanks.
You could use the region feature in screen rather than using the split screen within emacs... but then you might want to rebind the escape key in screen.

Select(mark) & right click paste feature (like on cisco's IOS) on linux (bash)

Is it possible to make/enable/config bash on linux to be able to copy content from terminal by just selecting it and to paste by right click (like when you connect to switch/router with ssh)?
Yep it is in fact it's on by default in most terminals see below for example. Ctrl-Shift-C & Ctrl-Shift-V are also very helpful in this regard. I'm using konsole in KDE but gnome-terminal and nearly every other terminal has this ability.
Without X/Gnome/KDE: if you install gpm you can use your mouse for copy/mark and paste on console.

alt-tab like functionality when using terminal?

When working in GUI we do alt-tab (or cmd-tab in mac) to switch between multiple programs, for example I am writing a text file in a text editor and then I do alt-tab to switch to already running browser to google up something then I alt-tab again to come back to keep editing.
How do you perform such "switch between" programs in command line interface - for example working with a ssh command line shell?
EDIT: I forgot to mention it, I am using ssh to connect to my university's server, and they don't have screen & tmux installed, and my account have no right to install any new apps... Is there any built-in functionality to perform this task, or any work around? For exmaple can I "minimize" running proggram and come back to regular shell interface, do some work, then display the "minimized" process again?
Another workaround: use the shell's job control, eg if you're editing a file, CTRL-z pauses the editor and brings you back to the shell, where you can compile, see manpages, browse the web or whatever -- and of course you can background the browser or anything else.
Screen command offers the ability to detach a long running process (or program, or shell-script) from a session and then attach it back at a later time.
As a crude workaround, run multiple terminal windows on your computer, and alt-tab between them.
Incidentally, at the Linux console, you can switch virtual terminals with ctrl+alt+F for at least F1 through F6, commonly F8 or more (depends on how the distro sets them up). Not your case, I know, but in case future visitors should benefit.
If you are comfortable in Emacs, it allows you to run multiple independent ansi-term buffers.
You can also use "GNU screen" to emulate multiple terminals in one terminal.

Resources