How to change the font size in terminal from terminal without the use of a mouse

9,554

The configuration file for lxterminal is: $HOME/.config/lxterminal/lxterminal.conf with the default font and size showing as:

fontname=Monospace 12

Simply alter this with your favourite command line editor such as vim and your changes are made. However it would be far cooler to use sed to accomplish with something like the following one-liner:

sed -i_bak '/^fontname/s/[0-9][0-9]$/22/' $HOME/.config/lxterminal/lxterminal.conf

This works by:

  1. sed -i_bak: Make the changes inline and save a backup of the original file with the suffix _bak
  2. '/^fontname/: Match the line with 'fontname' at the beginning.
  3. s/[0-9][0-9]$/22/' Substitute the last 2 numbers with '22' or the number for the size of the font that you require.

How cool is the command line!

References:

Share:
9,554

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I am working with LXTerminal 0.2.0 and want to know how to change the font size to make it easier in my eyes and for general knowledge so that I can do it in the absence of a mouse since that is what normally exists. I am trying to learn to be self sufficient working by myself with no mouse in a normal terminal environment. I am working with ubuntu 16.04lts. Please don't refer to gui as I know how that works.

    • guiverc
      guiverc almost 6 years
      alt-E pulls up the EDIT menu, <up> arrow then <enter> selects preferences, then I could tab to 'terminal font' & alter font size with <arrow>, <tab> & <enter> keys. I do realize you want a quick key way - but it works (I don't use lxterminal so haven't looked for better)
    • sudodus
      sudodus almost 6 years
      When you press (and hold) the alt key, the hotkeys for the pulldown menu items are underlined. Use E (while still holding the alt key) in English, and some other letter in other languages, for example R in Swedish, which stands for 'Redigera'.
    • DK Bose
      DK Bose almost 6 years
      What does Ctrl plus Shift plus the equals key do when all three keys are pressed together? In LXTerminal 0.3, that increases the font size (and window size) and Ctrl plus shift plus the minus sign decreases the font size (and the window size).
    • sudodus
      sudodus almost 6 years
      For me in Lubuntu 18.04 LTS with lxterminal 0.3.1 I can also use ctrl and + to increase the font and ctrl and shift and - to decrease the font. But this is only temporary. Do it via the Edit menu, if you want to change the settings in a persistent way.