Teach you how to change the font on the Linux console

Guided reading Linux  diehards, you can change the console font. According to the consistent nature of Linux, the ever-changing Linux environment makes this problem less straightforward, and there is no such thing as font management on Linux, which makes it easy for us to get confused. In this article, I'll show you the easiest way I've found to change fonts.

teach you how to change the font on the linux console teach you how to change the font on the linux console

I try to be as peaceful as possible, but there are always things that bother me, like the console font being too small. Mark my words, friends, one day your eyes will degenerate and you will no longer be able to see those tiny fonts you code with, and then you will regret it.

Fortunately, Linux diehards, you can change the console font. According to the consistent nature of Linux, the ever-changing Linux environment makes this problem less straightforward, and there is no such thing as font management on Linux, which makes it easy for us to get confused. In this article, I'll show you the easiest way I've found to change fonts.

What the hell is a Linux console?

First let's clarify what exactly we're talking about. When I refer to the Linux console, I mean TTY1-6, the virtual terminal you switch to with Ctrl-Alt-F1 to F6 from the graphical environment. Press Ctrl+Alt+F7 to switch back to the graphical environment. (However, these hotkeys are no longer common, and your Linux distribution may have different keymaps. Your number of TTYs may also be different, and your graphical environment session may not be F7. For example, Fedora's default graphical session is F2, It only has one extra terminal at F1.) I think it's really cool to have both an X session and a terminal session at the same time.

The Linux console is part of the kernel and does not run in an X session. It's the same console you would use in a headless server without a graphical environment. I call an X terminal in a graphical session a terminal, and the console and X terminal are collectively called a terminal emulator.

But it's not over yet. The Linux terminal has come a long way from the early ANSI days, and thanks to the Linux framebuffer, it now supports Unicode and also has some limited support for graphics. And there are a lot of multimedia applications running under the console, which we will mention in future articles.

console screenshot

The easiest way to take a screenshot of the console is to run the console inside a virtual machine. You can then grab it using your favorite screen capture software on the host system. But with fbcat and fbgrab you can also take screenshots directly on the console. fbcat will create an image in Portable Pixmap Format (PPM); this is a highly portable uncompressed image format that can be read on all operating systems, although you can of course convert it to any other you like Format. fbgrab is a package script of fbcat, used to generate a PNG file. Many people have written multiple versions of fbgrab. Each version has limited options and can only create screenshots of full screen.

Execution of fbcat requires root privileges, and its output needs to be redirected to a file. You don't need to specify a file extension, just enter the filename:

$ sudo fbcat > Pictures/myfile

After cropping in GIMP, you get the following image.
teach you how to change the font on the linux console teach you how to change the font on the linux console

It would be nice if there is a little padding in the left margin. If any readers know how to achieve this, please let me know in the message box.

fbgrab also has some options, which you can view with man fbgrab, including taking a screenshot of another console, and delaying screenshots. As you can see in the following example, fbgrab screenshots are similar to fbcat screenshots, except that you don't need to explicitly recharacterize the output:

$ sudo fbgrab Pictures/myOtherfile

Find fonts

As far as I know, there is no way to list the font storage directories other than /usr/share/consolefonts/ (Debian, etc.), /lib/kbd/consolefonts/ (Fedora), /usr/share/kbd/consolefonts (openSUSE) Installed fonts are displayed.

change font

Readable fonts are not a new concept. We should respect previous experience! Readability is important. Configurability is also important, but is less of a priority these days.

On systems like Debian/Ubuntu, you can run sudo dpkg-reconfigure console-setup to set the console font, then run the setupcon command on the console to make the changes take effect. setupcon is part of the console-setup package. If the tool is not included in your Linux distribution, it can be downloaded from openSUSE.

You can also edit the /etc/default/console-setup file directly. The following example sets the font to 32 point size Terminus Bold, which is my favorite, and strictly limits the console width to 80 columns.

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

The values ​​of FONTFACE and FONTSIZE here come from the font's filename TerminusBold32x16.psf.gz. Yes, you need to reverse the order of the values ​​in FONTSIZE. Computers are so funny. Then run setupcon again to make the new configuration take effect. You can use showconsolefont to view all character sets of the font currently in use. See man console-setup for a complete description of options.

Systemd

Systemd is not the same as console-setup, you don't need to install anything other than fonts. You just need to edit /etc/vconsole.conf and reboot. I installed some extra large font packages for Terminus on Fedora and openSUSE systems because the default installed font is only 16 points max and I want 32 points. Then modify the content of /etc/vconsole.conf to:

KEYMAP="us"
FONT="ter-v32b"

The original text comes from: https://www.linuxprobe.com/linux-font.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325114363&siteId=291194637