Command-line to switch between profiles in gnome-terminal

I created a new profile for gnome-terminal and I can switch between "Implicit" profile and the new created profile as you can see in the below image:

Switch between profiles in gnome-terminal

Now I wonder how can I switch between profiles using a command-line/script or maybe using a shortcut for this.

Note: Solutions like:

gnome-terminal --tab-with-profile=Implicit && exit 

are excluded because I prefer not to close and open another terminal or get another terminal window in this process of changing the profile.


A lot of great answers already but I wanted to add one more variation using xdotool that does not require the menu bar to be visible...

The key combo shift+F10 will open a pop-up menu (the equivalent of right-clicking on terminal) and from there the profile can be changed.

e.g. xdotool key shift+F10 r 3 to get to the third profile

I've also found that this method does not require setting a delay for xdotool (which I found necessary for the menu bar method) so it's therefore a little faster.

I tend to change profiles a lot so I wrap this into a function:

function chp(){
      xdotool key --clearmodifiers Shift+F10 r $1
}

so I can just call chp N to switch to the Nth profile.

Some more tips and idiosyncrasies of my setup:

  • By adding a chp command to my .bashrc I can force new tabs to always switch to the default profile

  • I color code my ssh sessions based on host but I don't like my ssh alias to open new tabs or windows AND I want the profile to change back to the default when I exit ssh. My solution: alias somehost="chp 2; ssh user@somehost; chp 1"

  • I give xdotool the flag --clearmodifiers so that if I happen to be holding a modifier key (when opening a tab/window, exiting ssh, etc.), it won't interfere with xdotool.

  • I prepend my profile names with numbers so that if I add a new one, it doesn't shift all the others due to the alphabetizing of the profile menu


To switch to the "implicit" profile:

xdotool key Alt+t p Return

To switch to the second profile:

xdotool key Alt+t p Down Return

xdotool Install xdotool is not installed by default in Ubuntu, so it must to be installed first.

Of course, for these commands can be added custom keyboard shortcuts.


There is no shortcut that allows you to change the profile within the terminal (without navigating the menus as you said in comments), without the use of the GUI. Quoting the manual (stable, development 3.9):

You can change the profile in your current Terminal tab or window by selecting a profile from Terminal ▸ Change Profile.

(You can propose this as suggestion in the bug tracker)