vc-reset-terminal 1 user commands nosh
vc-reset-tty chain-load utility for resetting virtual console terminals
`vc-reset-terminal` --hard-reset --no-utf8 --no-tostop --text-mode next-prog

## Description

`vc-reset-terminal` is a chain-loading utility that attempts to initialize the terminal and line discipline state of the terminal that is on its standard output, and then (if successful) chain loads to next-prog with the execvp 3 function. If its standard output is not a terminal, it aborts without attempting to initialize anything.

next-prog may contain its own command line options, which `vc-reset-terminal` will ignore.

`vc-reset-terminal` makes no alteration to process state.

It initializes the terminal by resetting the kernel virtual terminal mode, resetting the line discipline, and then outputting the escape sequences appropriate to the terminal type that initialize the terminal itself.

### Kernel virtual terminal mode reset

If the --text-mode command line option is used, `vc-reset-terminal` will use operating-system-specific ioctl 2 calls to attempt to switch a kernel virtual terminal to text mode.

### Line discipline reset

The line discipline is reset to approximately the same state as would be done by the `stty` sane command, with several exceptions:

- The `istrip` option is not set. 8-bit cleanliness is the norm nowadays.

- The `tostop` option is set, unless the --no-tostop command-line option has been used. Job control is the norm nowadays.

- The `iutf8` option is set, unless the --no-utf8 command-line option has been used. UTF-8 is the norm nowadays, and console-terminal-emulator 1 sends UTF-8 input sequences to virtual terminals.

### Terminal reset

`vc-reset-terminal` writes terminal escape and control sequences to soft (re-)initialize the terminal state, including tabstops, margins, windows, scrolling mode, and overstrike mode. If the --hard-reset command line option is used, different escape sequences are written to hard reset the terminal.

It emits these terminal control sequences by spawning console-control-sequence 1 with various options including --rows, --columns, and --soft-reset.

For compatibility of the actual control sequences emitted with various terminals and terminal emulators, see the console-control-sequence 1 manual.

## Use

The major use case for `vc-reset-terminal` is to reset the terminal and line discipline to some known states before printing the login banner (see login-banner 1) and running the login 1 program. The use case covers terminals that are "always on" and retain state from one terminal log-on session to the next, as is the case with real terminals (remote and local) and kernel virtual terminals.

`vc-reset-terminal` is, on the other hand, not particularly useful with console-terminal-emulator 1, which initializes the line discipline and terminal state itself to much the same state, and exits at hangup; making each log-on session start with an already freshly initialized terminal and line discipline.

The program is much the same as the BSD reset 1 command, except that it chain-loads to another command, has a more modern view of what a "sane" line discipline is, does not touch the line discipline's size information, and defaults to a softer reset. This is behaviour more suitable and streamlined for kernel virtual terminals, at which the command is specifically aimed.

Virtual terminals update the line discipline size themselves, either in response to control sequences that change the terminal size or as part of specialized idiosyncratic resizing utilities. So there is no need for a VT reset utility to adjust them directly. (Conversely, real terminals have no access to the line discipline and require that it be expressly kept in synch.)

Real terminals should not normally be sent the hard reset escape sequence, for reasons explained in the console-control-sequence 1 manual and DEC VT documentation. Conversely, the Linux and FreeBSD kernel virtual terminals do not implement the DEC soft reset control sequence. In line with the general principle of avoiding hard resets, the --hard-reset command line option should only be used with these kernel virtual terminals.

## SEE ALSO

- stty 1

## Author

Jonathan de Boyne Pollard