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] [fontname]
PARAMETERS
-V, --version
Display program version information.
-h, --help
Show a help message and exit.
-v, --verbose
Enable verbose output during operation.
-vc, --verbose-config
Be verbose about configuration files used.
-o
Save current console character map to file.
-om
Save current console Unicode map to file.
-ou
Save current console Unicode alternate map to file.
-O
Save current console font to file.
-C
Apply font changes to the specified console device (e.g., /dev/tty1).
-U
Load a Unicode map from file along with the font.
-M
Load a character map from file along with the font.
-u
Load a Unicode alternate map from file.
-d
Specify a directory to search for font files.
-L
Load only the font from file, without charmap or unimap.
-w
Set the font's character width (columns).
-h
Set the font's character height (rows).
-c
Set the character cell width.
-r
Set the number of text rows on the console.
-F
Use file as the default font if no fontname is provided.
-A, --auto-vertical-size
Automatically determine the vertical size of the font.
-W, --auto-hcount
Automatically determine the horizontal character count.
-T, --test
Test the font without actually loading it onto the console.
-e
Set console encoding (obsolete for modern Unicode consoles).
-s
Set font size, e.g., '8x16'.
-m
Load a character map from map (alias for -M).
-a, --ascii
Force ASCII-only character display (relevant for old terminfo setups).
-b, --8bit
Force 8-bit character display (relevant for old terminfo setups).
-p, --pcf
Load a PCF font (obsolete, most console fonts are PSF).
-t, --term
Set terminal type (obsolete, handled by kernel).
DESCRIPTION
setfont is a command-line utility used to load a font onto the Linux console (text-mode terminal, TTY). It allows users to change the appearance of text displayed on the virtual consoles, which are typically accessed via Ctrl+Alt+F1 to Ctrl+Alt+F6. Beyond just loading font files, setfont can also load associated character maps (.map files) and Unicode maps (.unimap files) to correctly display various character sets. This is crucial for internationalization, enabling the console to display non-ASCII characters, symbols, and various scripts.
The command supports various font formats, though often console fonts are in PSF (PC Screen Font) format. While modern Linux systems primarily operate in graphical environments, setfont remains essential for system recovery, single-user mode operations, or simply for users who prefer working directly on the console. It provides flexibility in customizing the text display for readability and aesthetic preferences.
CAVEATS
setfont primarily affects the text-mode virtual consoles (TTYs) and typically has no effect on graphical environments (like X11, Wayland) or terminal emulators running within them (e.g., GNOME Terminal, Konsole).
It requires root privileges to modify console settings.
Some options, such as -e
, -p
, and -t
, are considered obsolete in modern Linux distributions with improved Unicode support and kernel handling of terminal types.
COMMON USAGE EXAMPLE
To load a specific font, for example, the latarcyrheb-16.psfu.gz
font often found in /usr/share/kbd/consolefonts/
, you would use: sudo setfont latarcyrheb-16
The .psfu.gz
extension is often implied if the font is in the standard console font directory. You can specify a full path for fonts located elsewhere.
FONT LOCATIONS
Console fonts are typically stored in /usr/share/kbd/consolefonts/
or similar directories like /usr/share/consolefonts/
. These directories contain .psf
or .psfu.gz
(gzipped PSF Unicode) files, which are the standard formats for console fonts.
HISTORY
The setfont command has been a fundamental part of the kbd
(keyboard and console tools) package in Linux since its early days. Its primary role has always been to manage the display of text on the virtual consoles, adapting to evolving character encodings and font technologies. Initially, its focus was on 8-bit character sets and simple font formats. Over time, with the advent of Unicode and the need for global character support, setfont was updated to handle Unicode maps (.unimap
files) to allow the console to correctly render a wider range of characters beyond the basic Latin alphabet. While its direct interactive use might be less common in graphical desktop environments, it remains a critical component for system boot-up, recovery modes, and low-level console interactions, maintaining its relevance in the Linux ecosystem for decades.