I am using Ubuntu 14.04 and I want to set the background color of my gnome-terminal using the command line.
From what I can tell gconftool-2 is the way to do this but I cant work out what the command is to do this.

my ~/.gconf/apps directory looks like:

├── %gconf.xml
├── gnome-terminal
│   ├── %gconf.xml
│   └── profiles
│       ├── Default
│       │   └── %gconf.xml
│       └── %gconf.xml
└── nm-applet
    └── %gconf.xml 

If I run

gconftool-2 -a /apps/gnome-terminal/profiles/Default

I get a long list of key value pairs, e.g. pairs like this

scroll_on_output = false
 cursor_blink_mode = system
 background_color = #28F528F528F5

which I believe belong to the "default" gnome-terminal profile, but how do I then set these values using gconftool-2 ?

Ive worked out I can "get" values with

gconftool-2 --get /apps/gnome-terminal/profiles/Default/background_color

but not sure how to assign a new variable, in this case I would guess its a string, e.g. I would expect it to be something like

gconftool-2 --set /apps/gnome-terminal/profiles/Default/background_color --type=string: #ababab

or something like that?

  • Why gconftool2 ? you can do that through profile settings in gnome-terminal itself May 25 '15 at 18:02
  • 2
    its part of a bash install script , dont have access to GUI May 25 '15 at 18:03

Apparently gconftool-2 does not work anymore, however dconf did work for me. Close gnome-terminal and run this in xterm or another terminal emulator, or even tty.

Step 1: find the id of your desired profile

dconf dump /org/gnome/terminal/legacy/profiles:/ | awk '/\[:/||/visible-name=/'

My output:


So my Default profile has id :98707df3-b227-4a01-ae76-310f8270b9bd

Step 2: allow for using custom colors instead of system colors

sudo dconf write /org/gnome/terminal/legacy/profiles:/:98707df3-b227-4a01-ae76-310f8270b9bd/use-theme-colors "false"

Step 3: set your desired background color

sudo dconf write /org/gnome/terminal/legacy/profiles:/:98707df3-b227-4a01-ae76-310f8270b9bd/background-color "'#ABAB9B9B6060'"

Step 4: (re)start gnome-terminal.

  • thanks,when I copy paste your answer, commandline accepts it, exit status=0 but terminal background doesnt change, If I close and restart terminal, still no change. if I re-reun gconf --get .... it returns the previous color . Im suspecting your answer is correct regarding gconftool-2 but there possibly is a setting or startup script that is overriding the new value? May 25 '15 at 18:26
  • @user4668401 strange, I'm experiencing the same thing. The command is correct, but even with sudo it doesn't work May 25 '15 at 18:44
  • dconf works tho May 25 '15 at 18:59
  • Interesting , I was suspecting it was because the gnome-terminal inherits its colors from the "system theme" (tickbox option under colors menu) and looking into what the system theme setting is. and Im already overriding the terminal tab colors using CSS so I tried use gtk.css file. no luck. will look into dconf May 25 '15 at 19:06
  • @user4668401 I'm gonna edit my post a bit later. I guess it's the thing now in 15.04 . . .go figure, right ? May 25 '15 at 19:11

I just found out that gconf2 does seem to work - had the command wrong.
e.g. this works

gconftool-2 --set /apps/gnome-terminal/profiles/Default/background_color --type string "#393939"
  • 1
    Doesn't work in 16.04
    – Anwar
    Aug 12 '16 at 14:21
  • 1
    @Anwar Shah I think thats because 16.04 has had gtk version increased to 3 from 2 so now use gsettings insread of gconftool-2 Aug 12 '16 at 16:30

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.