Linux console

This article describes the basics of the Linux console and how to configure the font display. Keyboard configuration is described in the /Keyboard configuration subpage.

According to Wikipedia:

The Linux console is a system console internal to the Linux kernel. The Linux console provides a way for the kernel and other processes to send text output to the user, and to receive text input from the user. The user typically enters text with a computer keyboard and reads the output text on a computer monitor. The Linux kernel supports virtual consoles — consoles that are logically separate, but which access the same physical keyboard and display.

Implementation

The console, unlike most services that interact directly with users, is implemented in the kernel. This contrasts with terminal emulation software, such as Xterm, which is implemented in user space as a normal application. The console has always been part of released Linux kernels, but has undergone changes in its history, most notably the transition to using the framebuffer and support for Unicode.

Despite many improvements in the console, its full backward compatibility with legacy hardware means it is limited compared to a graphical terminal emulator.

Virtual consoles

The console is presented to the user as a series of virtual consoles. These give the impression that several independent terminals are running concurrently; each virtual console can be logged in with different users, run its own shell and have its own font settings. The virtual consoles each use a device /dev/ttyX, and you can switch between them by pressing Alt+Fx (where is equal to the virtual console number, beginning with 1). The device is automatically mapped to the active virtual console.

See also , and .

Text mode

Since Linux originally began as a kernel for PC hardware, the console was developed using standard IBM CGA/EGA/VGA graphics, which all PCs supported at the time. The graphics operated in VGA text mode, which provides a simple 80x25 character display with 16 colours. This legacy mode is similar to the capabilities of dedicated text terminals, such as the DEC VT100 series. It is still possible to boot in text mode (with ) if the system hardware supports it, but almost all modern distributions (including Arch Linux) use the framebuffer console instead.

Framebuffer console

As Linux was ported to other non-PC architectures, a better solution was required, since other architectures do not use VGA-compatible graphics adapters, and may not support text modes at all. The framebuffer console was implemented to provide a standard console across all platforms, and so presents the same VGA-style interface regardless of the underlying graphics hardware. As such, the Linux console is not a terminal emulator, but a terminal in its own right. It uses the terminal type linux, and is largely compatible with VT100.

Keyboard shortcuts

Keyboard Shortcut Description
Reboots the system (specified by the symlink )
, , , ... Switch to n-th virtual console
Alt+Left Switch to previous virtual console
Switch to next virtual console
When Scroll Lock is activated, input/output is locked
Kills current task
Inserts an EOF
Ctrl+z Pauses current Task

See also .

Fonts

By default, the virtual console uses the kernel built-in font with a CP437 character set, but this can be easily changed.

The Linux console uses UTF-8 encoding by default, but because the standard VGA-compatible framebuffer is used, a console font is limited to either a standard 256, or 512 glyphs. If the font has more than 256 glyphs, the number of colours is reduced from 16 to 8. In order to assign correct symbol to be displayed to the given Unicode value, a special translation map, often called unimap, is needed. Nowadays, most of the console fonts have the unimap built-in; historically, it had to be loaded separately.

The package provides tools to change virtual console font and font mapping. Available fonts are saved in the directory; those ending with .psfu or .psfu.gz have a Unicode translation map built-in.

Keymaps, the connection between the key pressed and the character used by the computer, are found in the subdirectories of ; see /Keyboard configuration for details.

Tip: For European based languages written in Latin/Greek letters, you can use the eurlatgr font. It includes a broad range of Latin/Greek letter variations as well as special characters .

Preview and temporary changes

$ showconsolefont

shows a table of glyphs or letters of a font.

temporarily change the font if passed a font name (in ) such as
$ setfont lat2-16 -m 8859-2

Font names are case-sensitive. With no parameter, returns the console to the default font.

So to have a small 8x8 font, with that font installed like seen below, use e.g.:

$ setfont -h8 /usr/share/kbd/consolefonts/drdos8x8.psfu.gz

To have a bigger font, the Terminus font (terminus-font) is available in many sizes, such as which is large.

Persistent configuration

The variable in is used to set the font at boot, persistently for all consoles. See for details.

For displaying characters such as Č, ž, đ, š or Ł, ę, ą, ś using the font :

/etc/vconsole.conf
...
FONT=lat2-16
FONT_MAP=8859-2

It means that second part of ISO/IEC 8859 characters are used with size 16. You can change font size using other values (e.g. ). For the regions determined by 8859 specification, look at the Wikipedia:ISO/IEC 8859#The parts of ISO/IEC 8859.

Since mkinitcpio v33, the font specified in /etc/mkinitcpio.conf gets automatically loaded during early userspace by default via the hook, which adds the font to the initramfs. See Mkinitcpio#HOOKS for more information.

If the fonts appear to not change on boot, or change only temporarily, it is most likely that they got reset when graphics driver was initialized and console was switched to framebuffer. To avoid this, load your graphics driver earlier. See for example Kernel mode setting#Early KMS start, or other ways to setup your framebuffer before is applied.

HiDPI

See HiDPI#Linux console (tty).

Audible tones

See PC speaker#Beep.

gollark: Python has a great websockets package.
gollark: I can probably help with both, but nobody will actually care.
gollark: Again, peripheral-over-websocket?
gollark: Modem-over-websocket + wireless peripherals?
gollark: Is there something wrong with modem-over-websocket?

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.