Teach you how to change the font on the Linux console
I try to keep my mind as peaceful as possible, but there are always some things that make me uncomfortable, such as the console font is too small. Mark my words, friend, one day your eyes will degenerate and you will no longer be able to see those tiny fonts you use when coding, and then you will regret it.
Fortunately, Linux diehards, you can change the console font. According to Linux's usual habit, the ever-changing Linux environment makes this problem less simple and clear, and there is no such thing as font management on Linux, which makes it easy for us to get confused. In this article, I'm going to show you the easiest way I've found to change fonts.
First let us clarify what we are talking about. When I mention Linux consoles, I'm referring to TTY1-6, the virtual terminals you switch to from a graphical environment with Ctrl-Alt-F1 to F6. Pressing Ctrl Alt F7 will switch back to the graphics environment. (However, these hotkeys are no longer universal, and your Linux distribution may have different key mappings. 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 an extra terminal in F1.) I think it's really cool to be able to have both an X session and a terminal session.
The Linux console is part of the kernel and does not run within an X session. It's the same console you use in a headless server without a graphical environment. I call the X terminal in a graphical session a terminal, and I refer to the console and X terminal collectively as a terminal emulator.
But it’s not over yet. The Linux terminal has come a long way from the early ANSI days and now has Unicode support and some limited support for graphics thanks to the Linux framebuffer. And there are many multimedia applications running under the console, which we will mention in future articles.
The easiest way to get a console screenshot is to run the console inside the virtual machine. You can then capture it using your favorite screenshot software on the host system. But with fbcat and fbgrab you can also take screenshots directly on the console. fbcat creates an image in Portable Pixel Map Format (PPM); this is a highly portable uncompressed image format that can be read on all operating systems, and of course you can convert it to any other you like Format. fbgrab is a wrapper 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 full screen captures.
The 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 file name:
$ sudo fbcat > Pictures/myfile
After cropping in GIMP, you get the picture below.
It would be nice if there was a little padding in the left margin. If any readers know how to achieve it, please tell me in the message box.
fbgrab also has some options, which you can view through man fbgrab. These options include taking a screenshot of another console, and taking a delayed screenshot. As you can see in the example below, fbgrab screenshots are similar to fbcat screenshots, except that you don’t need to explicitly recharacterize the output:
$ sudo fbgrab Pictures/myOtherfile
As far as I know, there is no other way than looking at the font storage directory /usr/share/consolefonts/ (Debian, etc.), /lib/kbd/consolefonts/ (Fedora), /usr/share/kbd/consolefonts (openSUSE) Method to list installed fonts.
可读字体不是什么新概念。我们应该尊重以前的经验!可读性是很重要的。可配置性也很重要,然而现如今却不怎么看重了。
在 Debian/Ubuntu 等系统上,可以运行 sudo dpkg-reconfigure console-setup 来设置控制台字体,然后在控制台运行 setupcon 命令来让变更生效。setupcon 属于 console-setup 软件包中的一部分。若你的 Linux 发行版中不包含该工具,可以在 openSUSE 中下载到它。
你也可以直接编辑 /etc/default/console-setup 文件。下面这个例子中设置字体为 32 点大小的 Terminus Bold 字体,这是我的最爱,并且严格限制控制台宽度为 80 列。
ACTIVE_CONSOLES="/dev/tty[1-6]" CHARMAP="UTF-8" CODESET="guess" FONTFACE="TerminusBold" FONTSIZE="16x32" SCREEN_WIDTH="80"
这里的 FONTFACE 和 FONTSIZE 的值来自于字体的文件名 TerminusBold32x16.psf.gz。是的,你需要反转 FONTSIZE 中值的顺序。计算机就是这么搞笑。然后再运行 setupcon 来让新配置生效。可以使用 showconsolefont 来查看当前所用字体的所有字符集。要查看完整的选项说明请参考 man console-setup。
Systemd 与 console-setup 不太一样,除了字体之外,你无需安装任何东西。你只需要编辑 /etc/vconsole.conf 然后重启就行了。我在 Fedora 和 openSUSE 系统中安装了一些额外的大字号的 Terminus 字体包,因为默认安装的字体最大只有 16 点而我想要的是 32 点。然后将 /etc/vconsole.conf 的内容修改为:
KEYMAP="us" FONT="ter-v32b"
The above is the detailed content of Teach you how to change the font on the Linux console. For more information, please follow other related articles on the PHP Chinese website!

A GUI for Effortless Flatpak Management: Introducing Warehouse Managing a growing collection of Flatpak applications can be cumbersome using only the command line. Enter Warehouse, a user-friendly graphical interface designed to streamline Flatpak a

This article provides a comprehensive guide to identifying and resolving hard drive bottlenecks in Linux systems. Experienced server administrators will find this particularly useful. Slow disk operations can severely impact application performance,

Efficient QR code generation tool under Linux system In today's digital world, QR codes have become a way to quickly and conveniently share information, simplifying data access from URLs, texts, contacts, Wi-Fi credentials, and even payment information. Linux users can use a variety of tools to create QR codes efficiently. Let's take a look at some popular QR code generators that can be used directly on Linux systems. QRencode QRencode is a lightweight command line tool for generating QR codes on Linux. It is well-received for its simplicity and efficiency and is popular with Linux users who prefer direct methods. Using QRencode, you can use the URL,

Elementary OS 8 Circe: A Smooth and Stylish Linux Experience Elementary OS, a Ubuntu-based Linux distribution, has evolved from a simple theme pack into a fully-fledged, independent operating system. Known for its user-friendly interface, elegant de

Mastering Linux is crucial for any machine learning (ML) engineer. Its command-line interface offers unparalleled flexibility and control, streamlining workflows and boosting productivity. This article outlines essential Linux commands, explained fo

Arch Linux: A Beginner's Command-Line Cheat Sheet Arch Linux offers unparalleled control but can feel daunting for newcomers. This cheat sheet provides essential commands to confidently manage your system. System Information & Updates These com

This guide provides a comprehensive walkthrough of installing and using the Scikit-learn machine learning library on Linux systems. Scikit-learn (sklearn) is a powerful, open-source Python library offering a wide array of tools for various machine l

This guide explains how to leverage Docker for accessing Kali Linux tools, a safer and more efficient alternative to outdated methods like Katoolin. Katoolin is no longer actively maintained and may cause compatibility problems on modern systems. Do


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!
