Command-line to switch between profiles in gnome-terminal

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.


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


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)