21

I made some custom GNOME-Terminal settings and profiles, and I want to preserve those after reinstalling Ubuntu.

What do I have to save to backup my settings, and how do I reapply them afterwards?

This is not a duplicate of this question, because

  1. Configuration systems changed since the old question, from gconf to dconf.
  2. The other question does not explain how to properly backup, and then reapply the settings.
Th. Ma.
  • 107
  • 1
  • 4
red_trumpet
  • 1,849
  • Mostly duplicate, although the question over there is not phrased as clearly as this one, and as such, none of the answers tells you how to back up and restore the settings. Plus, the most voted and accepted answer there is obsolete. – egmont Oct 22 '17 at 10:00
  • 2
    And additionally, I don't have a folder ~/.gconf/apps/gnome-terminal/. – red_trumpet Oct 22 '17 at 10:02

1 Answers1

34

GNOME Terminal itself doesn't provide such an option, so you have to manually operate on its database.

Beginning with version 3.8 it uses GSettings, which in turn (at least on Linux systems) uses dconf. It would probably be more elegant to go with the gsettings tool. Unfortunately I couldn't figure out how to dump all the relevant data there, let alone restore them. So let's use dconf.

Based on this article, you can dump your settings using:

dconf dump /org/gnome/terminal/ > gnome_terminal_settings_backup.txt

Reset (wipe out) the settings before loading a new one (probably not really required):

dconf reset -f /org/gnome/terminal/

Load the saved settings:

dconf load /org/gnome/terminal/ < gnome_terminal_settings_backup.txt

Disclaimer: I haven't tested the restore steps. I recommend that before the reset/load operations you back up your entire dconf database, which is stored in the single file ~/.config/dconf/user, using a simple standard filesystem copy operation (as opposed to some dconf command). In case of problem you can restore it just as easily (maybe from another terminal emulator or the Linux console).

egmont
  • 8,225
  • 1
    Jup, that's it. Also backed by this answer – red_trumpet Oct 22 '17 at 13:27
  • What's wrong with backing up just ~/.config/dconf/user ? Is it only a matter of 10 times size? – bloody Apr 01 '20 at 13:02
  • You can do that, it's not wrong per se. It's a binary file containing all your GNOME configs. You can't easily examine or load (restore) only parts of it, though. – egmont Apr 01 '20 at 13:14
  • Thanks. I looked in dump output, yea, kinda more interesting, I'll also stick to this one after all:) – bloody Apr 01 '20 at 14:01
  • Maybe the best is to dump and backup everything (dconf dump /), and then you can easily select what you want to restore. – egmont Apr 01 '20 at 14:10
  • The use of gsettings with gnome-terminal is documented here: https://askubuntu.com/questions/731774/how-to-change-gnome-terminal-profile-preferences-using-dconf-or-gsettings and here: https://ncona.com/2019/11/configuring-gnome-terminal-programmatically/ – rtsai2000 Dec 26 '20 at 19:26