116

XTerm font is very small. How can I set it larger?

2
116

If you don't already have one, create a file in your home directory named .Xresources to store your preferences for various X programs. Append a line to the file such as

xterm*font:     *-fixed-*-*-*-18-*

This informs xterm to use the 'fixed' font at size 18.

From here, you can either restart X or run xrdb -merge ~/.Xresources in a terminal to incorporate the changes you've made. All new xterms should now have the font change.

If you run man xterm and go down to the RESOURCES section, you can find a wealth of additional, configurable xterm options.

6
  • Thanks noffle it worked....but how can i set the dimensions of the xterm windows to a fixed ones?
    – Sudo
    Jul 10 '12 at 9:32
  • 3
    The X resource for dimensions is geometry. So something like the following in your .Xresources would work: xterm*geometry: 110x50.
    – noffle
    Jul 10 '12 at 14:07
  • 6
    You're welcome. Consider creating a separate question in the future for the geometry issue rather than tacking it into a comment: it makes it harder for others to find.
    – noffle
    Jul 10 '12 at 17:06
  • Thanks for mentioning 'xrdb -merge' part, that did the trick!
    – HidekiAI
    May 10 '16 at 12:16
  • 3
    xterm: cannot load font '*-fixed-*-*-*-38-*' Warning: Shell widget "xterm" has an invalid geometry specification: "*-fixed-*-*-*-38-*" Apr 20 '18 at 17:53
68

Use -fa and -fs parameters:

xterm -fa 'Monospace' -fs 14
5
  • 4
    This does not "change the default font size" (as requested)!
    – Dirk
    Aug 23 '16 at 15:58
  • That works at the command line but not from the GUI.
    – SDsolar
    Aug 1 '17 at 17:52
  • Using Monospace will not just change the size but use a quite different font (at least that's the case on Ubuntu 18.04). And I find Monospace to be using excessive amounts of anti-aliasing which makes it looks blurry when viewed next to an xterm window using the default font.
    – kasperd
    Jan 9 '19 at 10:34
  • To list monospaced xterm fonts: fc-list | cut -f2 -d: | sort -u | grep -i Mono. If you prefer sans fonts, try DejaVu Sans Mono, Liberation Mono, Noto Mono or Ubuntu Mono.
    – noobninja
    Jan 15 '20 at 23:16
  • 1
    +1 Excellent. Only command line one that worked for me.
    – copper.hat
    Nov 2 '20 at 0:13
47

You can also Ctrl-Right mouse click for temporary change of font size

2
  • 3
    How do you find out what font size and face you have actually selected with this method, so you can make it the default in ~/.Xresources ?
    – Geeb
    Nov 13 '17 at 18:00
  • 3
    @Geeb you can find out which font corresponds to which menu entry with appres XTerm | grep -i utf8font Nov 10 '18 at 15:52
37

You can add the following as an example to your ~/.Xresources file:

! Use a truetype font and size.
xterm*faceName: Monospace
xterm*faceSize: 14

Then run the following:

xrdb -merge ~/.Xresources
2
11

From messing with /etc/X11/app-defaults/XTerm file and man page for Xterm I found two methods.

Method 1: A simpler method but not permanent: hold Ctrl key and right click button. This should bring up a menu for VT fonts, which stays on only as long as you hold right click key. You should see 7 choices, the largest being huge, which is what I'm using because my vision isn't exactly good.

Source: xterm(1) man page, part VT Fonts, which states "The fontMenu pops up when when the “control” key and pointer button three are pressed in a window."

Method 2: Permanent. Look through /etc/X11/app-defaults/XTerm, find what sizes lines such as *VT100.font1: , choose one, and write somewhere xterm*font: 10x20 (10x20 , again this is my choice for reasons I already stated).

About my system: I'm running Ubuntu 13.10

2
  • 1
    Didn't notice that dolzenko has already posted method 1 before. Oh, well. Aug 6 '14 at 8:37
  • 1
    And method 2, changing system files, is not recommended. You (and all users on your system) may loose your modifications any time when an update overwrites that file.
    – Dirk
    Aug 23 '16 at 15:59
6

One more option, add this to your ~/.Xresources to make hotkeys for changing the font size:

XTerm.vt100.translations: #override \n\
  Ctrl <Key> minus: smaller-vt-font() \n\
  Ctrl <Key> plus: larger-vt-font()

If you use uxterm, be sure to use UXTerm.vt100.translations instead.

Then you can use ctrl++ to increase font size or ctrl+- to decrease the size, just like you can with ctrl+right-click and selecting one of the other font size options.

3

you can also simply test them with :

xterm -fn "--clean--*---*---*---*-*"

after sel with xfontsel

2

Creating the .Xresources file with specified lines of code (provided in the answer by noffle) fixed my issue, but on reboot the settings got lost again.

If the settings specified in the .Xresource file are not getting reflected automatically, try adding the below line to ~/.bashrc.

[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources
1
  • 2
    This should probably be a comment instead (on the answer you mention) Jan 13 '18 at 1:43
0

If you are using code::blocks for C/C++ Development in ubuntu, then i would recommand changing your terminal to the gnome-terminal and to do so go to Settings > Enviorment > General Settings and then change the default terminal to the gnome-terminal.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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