setfont
Change the console font
TLDR
Change the terminal font
Change the terminal font by specifying a path
Double font size
Reset to the default font
SYNOPSIS
setfont [options] fontfile [keymap]
PARAMETERS
-v
Verbose mode. Prints debugging information.
-h height
Set the console screen font height, where height is the number of scan lines to use for each character cell. Usually used when automatic font height detection fails.
-V
Display version information.
-default
Loads the default font set in the kernel during compilation.
-C console
Operates on the specified console.
-O console
Same as -C but does not perform any ioctls on console and only makes font available.
DESCRIPTION
The setfont command is used to load a console font and, optionally, a keyboard mapping table onto the Linux console. It allows users to customize the appearance of the console and the way keys are interpreted. This tool is crucial for configuring character sets, font sizes, and keyboard layouts. It typically takes the name of a font file and, optionally, a keymap file as input. The font file specifies the glyphs used to render characters on the screen, while the keymap file defines the mapping between key presses and characters or actions. Setting the font and keymap can improve readability and usability of the console especially important when using foreign language fonts. Font files usually have .psf or .pcf extensions, and keymap files have .map or .kmap extensions. Note that modern systems using systemd-vconsole-setup usually handle console font configuration automatically during boot.
CAVEATS
The setfont command requires root privileges to modify the console's font and keymap. It's possible to misconfigure the console and make it unreadable, so caution is advised. On modern systems, configuration of console fonts and keymaps are often managed by systemd services like systemd-vconsole-setup.
FONT FILES
Font files used with setfont are usually in .psf (PC Screen Font) or .pcf (Portable Compiled Format) format. .psf fonts are generally preferred for the console.
KEYMAPS
Keymaps define the mapping between key presses and the characters or actions they produce. They are stored as .map or .kmap files.
EXAMPLE
To load the LatArCyrHeb-16 font: setfont LatArCyrHeb-16
To load the LatArCyrHeb-16 font and a custom keymap: setfont LatArCyrHeb-16 mykeymap.map
HISTORY
The setfont command has been a part of the Linux console setup toolkit for a long time. It predates modern display managers and graphical environments, providing a way to customize the text-based console interface. In the early days of Linux, it was essential for configuring non-ASCII fonts and keyboard layouts. While its direct use is less common now with GUI-based configuration tools, setfont remains available and useful for console-only environments or when troubleshooting display issues. It allows to change fonts and keymaps even without a graphical interface.