Can we reopen an accidentally closed tab in gnome terminal? Assume the closed tab is the last closed one.
In firefox, we can use Ctrl-shift-t to do that. But I haven't found away in gnome terminal yet. Thanks.
Unfortunately, you cannot open old tabs in the Gnome-Terminal. Because Firefox is a web browser when you open a previous tab like that it just goes to the history file and goes to the website as the last entry. It is reloaded from the ground up.
The Gnome-Terminal does not activate/go to set pages, instead it is just an interface to the console so you cannot go to previous pages.
If you just want to have all the commands you had previously run ran again so you could be in a certain place with certain things set, you can go to you
.bash_history file (sometimes it is called
.history). This contains a list of all your previous commands and is how you can click the up arrow key to go through your command history. You can just copy-paste out of that with
ctrl-shift-v in the gnome terminal.
If it something you want to run as a script to "set you up" in your previous state you can make a bash script out of the lines of history that you need.
If you want it to run every time bash launches then add those lines to the end of your
A Terminal Tab once closed flushes out all the output that was available on the screen. Plus, there is nothing that keeps a tab on what output was shown to which tab under normal circumstances. That is why, there is no functionality to go back.
Though Firefox allows to re-open the Closed tab, it first looks into Cache, otherwise it requests the Server again. In our case, Terminal doesn't know such thing as cache to fall back and it certainly cannot issue a request(commands) because nothing keeps a tab on output.
There exists ways by which you can log all the output automatically into a file in case, you want to take a look again at output. One way is
TermRecord, but discussing it would be out of the context of this question.
As it's clear that there is no functionality of reopening accidentally closed tab in gnome terminal, you can do another thing.
Hold the terminal open when command exits (ctrl + D or exit command) Menu > Edit > Profile Preferences > (tab) Title and Command > When command exits : Hold the terminal open
Change the keyboard shortcuts of closing tab and closing window other than ctrl + w and alt + f4 respectively as you are habitual of pressing them frequently
Now your tab will not close accidentally, and keep it open until you are sure that you don't need it again