7

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.

  • Check here,you might get some help from here. – serenesat Mar 3 '15 at 12:57
  • 1
    firefox will get (more or less) static page content from cache. when you close a gnome terminal tab, I suspect its content is throw away. I wouldn't have too much hope. – Archemar Mar 3 '15 at 14:31
4

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-c and 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 .bahsrc file.

1

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.

1

As it's clear that there is no functionality of reopening accidentally closed tab in gnome terminal, you can do another thing.

  1. 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

  2. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.