When working in several tabs in gnome terminal, if I close one tab, do I lose all the command history in the tab?

In an existing tab, Is there a way to retrieve a previous command typed in a closed tab?


  • see also: unix.stackexchange.com/questions/18212/… – Sundeep Oct 22 '16 at 16:35
  • 3
    Command history is up to your shell and has nothing to do with the terminal. I see you've tagged the question bash, so I think you're actually asking this question about Bash not about Gnome Terminal. Short answer is that most installations of Bash are set up to save history by default. – Celada Oct 22 '16 at 17:08
  • @Celada It is related to terminal. each gnome terminal tab runs a separate bash process. When you close a terminal tab, you kill its bash process. – Tim Oct 22 '16 at 17:20
  • 4
    @Tim: correct, but nothing to do with the terminal. When you exit a shell using any other method (such as logging out of an SSH session) the same thing happens. – Celada Oct 22 '16 at 17:35
  • 2
    ... A nudge toward what I think is the answer you seek... I've ran into this myself. When you open several tabs, each Gnome Terminal tab / bash shell keeps its own history log (they act in a "compartimentalized" way). History logs are consolidated when you've exited all bash shells opened with tabs. Subsequently when as you reopen your first terminal window, I think you should see a consolidated history of all previously opened tabs. – Cbhihe Oct 23 '16 at 7:49

Your Answer

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

Browse other questions tagged or ask your own question.