If you have a graphical desktop environment, it’s easy to change the font and size of the text. But how do you do that in Ubuntu headless servers with no graphics environment? Don’t worry! This guide describes how to change the font and size of the Linux console. This is useful for people who don’t like the default font type/size or prefer different fonts.

Change the Linux console font type and size

In case you didn’t already know, this is what a headless Ubuntu Linux server console looks like.

Ubuntu Linux Console

As far as I know, we can list the fonts that are installed, but there is no way to change the Linux console font type or size as in Linux desktop Terminal Emulator.

But that doesn’t mean we can’t change it. We can still change the console font.

If you’re using Debian, Ubuntu, and other deb-based systems, you can use the console-setup configuration file to setup setupcon, which is used to configure the font and keyboard layout for the console. The configuration file for this console setup is located in /etc/default/console-setup.

Now, run the following command to set the font for the Linux console.

$ sudo dpkg-reconfigure console-setup
Copy the code

Select the encoding to use on the Linux console. Simply leave the defaults, select “OK” and press Enter to continue.

Select the encoding you want to set on the Ubuntu console

Next, select the supported character set from the list. By default, this is the last option, Guess Optimal Character Set on my system. Just leave the defaults and press Enter.

Select the character set in Ubuntu

Next, select the font for the console and press Enter. I’m going to choose “TerminusBold”.

Select the font for the Linux console

Here, we select the font size we want for the Linux console.

Select the font size for the Linux console

After a few seconds, the selected font and size will be applied to your Linux console.

This is what the console font looks like on my Ubuntu 18.04 LTS server before changing the font type and size.

This is after the change.

As you can see, the text is bigger and better, and the font type is different from the default.

You can also directly edit /etc/default/console-setup and set the font type and size as required. Based on the following example, my Linux console font type is “Terminus Bold” and the font size is 32.

ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="UTF-8"
CODESET="guess"
FONTFACE="TerminusBold"
FONTSIZE="16x32"
Copy the code

Appendix: Display console fonts

To display your console font, simply type:

$ showconsolefont
Copy the code

This command displays the glyph or alphabet of the font.

Display console font

If your Linux distribution doesn’t have console-setup, you can get it here.

On Linux distributions that use Systemd, you can change the console font by editing /etc/vconsole.conf.

Here is an example configuration for a German keyboard.

$ vi /etc/vconsole.conf

KEYMAP=de-latin1
FONT=Lat2-Terminus16
Copy the code

Hope this article is useful to you!


Via: www.ostechnix.com/how-to-chan…

Sk Selected by Lujun9972

This article is originally compiled by LCTT and released in Linux China