console 4 devices FreeBSD
freebsd-console system console device

## Description

The `/dev/console` device provides access to the FreeBSD console. What the console actually is can vary. The kernel maintains a list of console devices. The `/dev/console` device maps to the first device in the list. (Thus application output via `/dev/console` differs from kernel console message output, which goes to all devices listed.)

The kernel's list of console devices is in the `kern.console` kernel state variable, supplied to it by the bootstrap kernel loader 8. This variable lists one or more serial port devices (see uart 4 and sio 4) or kernel virtual terminal devices (see syscons 4 and vt 4).

`/dev/console` is a fully functional terminal device, with a line discipline. Its input and output are routed via the underlying device by the kernel.

Process 1 commences execution with its standard input, output, and error file descriptors open to the console device, and the console device as the controlling terminal of its session.

A devfs 5 filesystem automatically gains a node named `console` that denotes this device.

## Standards conformance

The `/dev/console` device filename for the system console is required in order to conform with the Single Unix Specification (per "Directory Structure and Devices"). This explicitly permits it to be a link to another device. FreeBSD does not implement it as a link, however.

## See also

conscontrol 1

  A convenience tool for manipulating the kernel's console device list.

sysctl 1

  Lower level access to kernel variables.

syslog 3

  Opening `/dev/console` and writing messages there is an optional functionality of the syslog library.

## Author

Documentation by

Jonathan de Boyne Pollard