12

In Mac, if I have a few Terminal windows open and I restart the computer or quit Terminal, the windows that were open last are opened again with their working directories and command histories retained.

Is there a way to similarly reopen Ubuntu Terminal windows?

1
  • Which desktop environment are you using? Unity (the Ubuntu default) or something else? And which terminal emulator are you using? (I don't know what the Ubuntu default is these days — gnome-terminal?) Commented Apr 5, 2016 at 23:54

2 Answers 2

6

Technically it depends upon the chosen desktop. The question has been asked here and there without any good answers. For gnome-terminal, a commonly proposed solution is adding the --save-config option, e.g.,

gnome-terminal --save-config=/home/whatever/foo

There is also the dconf-editor which might be effective, depending on what applications you use.

In either case, those would only restore a shell to a given working directory; restoring programs running within the shell seems to be glossed over generally (except for the rare case where the application also has session support).

Further reading:

1
  • Option “--save-config” is no longer supported in this version of gnome-terminal (3.28.2)
    – ChrisW
    Commented Aug 16, 2019 at 12:03
0

I too was annoyed after switching from mac to windows, couldnt get to restore terminals (WSL) and would restart with fresh window. What worked for me was that I installed ubuntu via VMWare, and VMWare by default suspends upon restart of windows, hence whenever I reboot and reopen the VMWare app, I find all applications, including terminal tabs in same (restored) state as it was before reboot. Hope this helps others.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .