Ubuntu – Change terminal font size programatically

fontsgnome-terminal

is that possible to do that by running a command? Is there any hack that would allow this? I tried using python-uinput to simulate pushing Ctrl+Plus in order to make font bigger but it did not work.

I am trying to display images in the terminal without any need for a gui. this is possible using timg. However the image resolution is quite bad. When I make the font size of the terminal very small, the image is displayed at almost native resolution.

I want to write a script hat will automatically reset the terminal, resize its font to a very small size and finally call timg to display the image. This will allow ssh into a remote robot and displaying the latest image it acquired without having to first copy it back to my computer.

I am mostly working with gnome-terminal or terminator

Best Answer

to change the gnome-terminal font size via command line,

  1. first we need to know the current profile id of the gnome-terminal. I am using the default one which is named as "Unnamed"

enter image description here

in my case the profile id is something that is starting with "b1dcc9" enter image description here

  1. Custom font square must be ticked.

enter image description here

  1. run the below command to get the list of profiles
    gsettings get org.gnome.Terminal.ProfilesList list

Example:

$ gsettings get org.gnome.Terminal.ProfilesList list
['b1dcc9dd-5262-4d8d-a863-c897e6d979b9', 'd2a064f8-146d-45b5-8da7-d7e2f34da77e', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa']

I already know that my current profile is something that is starting with "b1dcc9"

  1. get the font name and size with the below command gsettings get org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/ font

Example:

$ gsettings get org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/ font
'Noto Mono Bold 12'
$
  1. Set the font name and size with the below command gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/ font 'Ubuntu Mono Italic 50'

Example:

$ gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/ font 'Ubuntu Mono Italic 50'
$

Caution: do not put font size in high values, it will make the OS non operative. by mistake i press 512 instead of 52 and press enter..struggled a lot to get back.

enter image description here

Related Question