Chapter 2. Virtual Terminal

2.1. Introduction

Virtual Terminal, commonly referenced and documented as vt(4) is the system’s built-in virtual console. It is installed by default, provides a command-line interface, and starts automatically at boot. This chapter presents an overview and examples of key features and utilities relevant to visual accessibility.

2.2. Colors

The Virtual Terminal supports color configuration both via configuration files and interactively through a dedicated utility.

2.2.1. Loader.conf

Colors can be set and saved using the loader.conf(5) file. To change a default color, add a line in the following format: kern.vt.color.colornum.rgb="colorspec", where:

  • colornum is the numeric identifier of the color to be customized (see the table below).

  • colorspec is a specification of the color, either as a comma-separated RGB triplet (red, green, and blue, each value from 0 to 255) or as an HTML-style hexadecimal value.

Table 1. Default palette: Color, color number, default color in rgb, default color in html.
Colorcolornumdefault colorspec RGBdefault colorspec html

Black

0

0,0,0

#000000

Dark red

1

127,0,0

#7f0000

Dark green

2

0,127,0

#00fF00

Dark yellow

3

196,161,0

#c4a100

Dark blue

4

51,102,163

#3366a3

Dark magenta

5

127,0,127

#7f007f

Dark cyan

6

0,127,127

#007f7f

Light gray

7

191,191,191

#bfbfbf

Dark gray

8

115,130,138

#73828a

Light red

9

255,0,0

#ff0000

Light green

10

0,255, 0

#00ff00

Light yellow

11

255,255,0

#ffff00

Light blue

12

115,158,207

#739ecf

Light magenta

13

255,0,255

#ff00ff

Light cyan

14

0,255,255

#00ffff

White

15

255,255,255

#ffffff

Example 1. Set background in white, text in black, boot messages in red.

/boot/loader.conf

# Background black to white
kern.vt.color.0.rgb="255,255,255"

# Text light gray to black
kern.vt.color.7.rgb="0,0,0"

# Boot white to red
kern.vt.color.15.rgb="255,0,0"

2.2.2. Vidcontrol

The vidcontrol(1) utility allows you to configure colors interactively. Use the show option to display the list of available colors:

% vidcontrol show

To set the foreground color, use vidcontrol color. For example, to set the text color to green:

% vidcontrol green

To set both foreground and background colors, use vidcontrol foreground background. For example, to set blue text on a green background:

% vidcontrol blue green

Configurations made with man:vidcontrol are not persistent across shutdown. To make the settings permanent, add the following line to rc.conf(5): allscreens_flags="-c foreground background".

Example 2. Set blue foreground and green background.

/etc/rc.conf

allscreens_flags="-c blue green"

Setting allscreens_flags="-c colors" in /etc/rc.conf takes effect after the system boots. To change the colors during the boot process, edit /boot/loader.conf as previously described.

2.3. Resolution

The kern.vt.fb.default_mode="<width>x<height>" option in loader.conf(5) allows you to configure the display resolution. Technically, it specifies the display mode of the Virtual Terminal, allowing you to control the size of elements displayed on the screen.

Example 3. Sets the width to 800 and the height to 600.

/boot/loader.conf

kern.vt.fb.default_mode="800x600"

2.4. Font

Virtual Terminal allows you to configure the font in use, and the system supports installing and utilizing additional fonts.

2.4.1. Select a Font

The utilities vidfont(1) and vidcontrol(1) can load a font from /usr/share/vt/fonts/. To list the currently available fonts:

% ls /usr/share/vt/fonts

Usually a file name has the format <name>-<width>x<height>, where:

  • <name> is the font name.

  • <width>x<height> is the size.

vidfont(1) provides an interactive menu in a Text User Interface to select a font. Run the following command:

% vidfont

Alternatively, vidcontrol(1) provides a CLI, vidcontrol -f font. Example for spleen-32x64.fnt:

% vidcontrol -f spleen-32x64.fnt

Tip: You can omit the .fnt extension when specifying the file name. For example, to load spleen-32x64.fnt, use:

% vidcontrol -f spleen-32x64

Settings configured with either utility are not preserved after a reboot.

Example 4. Select the font to load at each startup.

/etc/rc.conf

allscreens_flags="-f spleen-32x64.fnt"

2.4.2. New Fonts

The vtfontcvt(8) utility allows you to convert a font into the .fnt format for use in the Virtual Terminal. The converted font must be copied to /usr/share/vt/fonts/ and selected as previously described.

2.5. Bell

The terminal bell can be activated by:

# sysctl kern.vt.enable_bell=1

To make the configuration persistent after reboot, save it in either loader.conf(5) or sysctl.conf(5).

Example 5. Active the bell at each startup.

/boot/loader.conf or /etc/sysctl.conf

kern.vt.enable_bell=1

Last modified on: June 17, 2025 by Alfonso Siciliano