I'd like to change the background color of the Ubuntu terminal emulator to say, red. However, I want to do it using the commandline, like the Windows equivalent color 0F, since I'm making a program that has changing the background color as a core function and I don't really want it to rely on any dependencies, unless it is really necessary.

Regarding the comment saying there's already an answer to this:

The answer on the question requires a package in order for it to work. I need a way for it to work without a package.

  • With “Ubuntu terminal” you mean plain Ubuntu’s default terminal emulator gnome-terminal, don’t you?
    – dessert
    May 9, 2019 at 11:40
  • Yes, I do. And also, it is not a duplicate of "Command-line to switch between profiles in gnome-terminal". The answer there requires a package to be installed. And I want a full background, not just behind the text.
    – tequila
    May 9, 2019 at 11:47
  • What about Changing colour of text and background of terminal?
    – dessert
    May 9, 2019 at 11:59
  • 1
    @dessert gconftool-2 is not only no longer used by gnome-terminal, but also modifies the settings of all the tabs running the given profile; unlikely what OP is looking for. tequila, you're perhaps looking for the OSC 10 / 11 escape sequences, see my new answer in one of the aforementioned duplicates.
    – egmont
    May 9, 2019 at 13:56
  • 1
    @dessert We definitely need clarification from OP (in case the duplicates don't answer their question). "I'm making a program that has changing the background color as a core function" - this suggests to me that it's that particular program that would set it only for the terminal where it's running. But it's indeed not fully clear.
    – egmont
    May 9, 2019 at 15:35

1 Answer 1


below script is to change only the Default Profile terminal background color.



defaultprofile=$(gsettings get org.gnome.Terminal.ProfilesList default)
profileID=$(echo "$defaultprofile" | cut -d "'" -f 2)
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profileID/ background-color yellow

enter image description here

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