Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

pi/agent/skillz/lnx/linux-console/references/model.md

Raw
Rendered preview

Model

Terms

  • Linux console: kernel console implementation.
  • Virtual console / VT: numbered console, usually /dev/ttyN.
  • pty: pseudo-terminal, usually /dev/pts/N; not a real VT.
  • TERM=linux: terminfo name commonly used by Linux VTs.
  • framebuffer console / fbcon: kernel console display path on many systems.

Detection

Evaluate the target session, not the agent's execution context. Strong signal from the target:

/dev/ttyN + TERM=linux

/dev/pts/N identifies the probed session as a pty, not the user's separate VT. Agent output of /dev/pts/N or not a tty leaves the target unknown. Confirm the target host and VT; continue remote diagnosis rather than stopping.

Use exact user wording too: tty1, tty2, virtual console, linux console, Ctrl+Alt+F1, getty, fbcon.

Terminfo

infocmp -1 linux shows what clear, reset, curses apps, and terminfo-aware programs will emit.

Inspect, do not assume:

infocmp -1 linux | grep -E 'clear|rs1|rs2|rs3|oc|op|initc|sgr0'

Clear vs Reset

clear normally clears/redraws screen state.

reset reinitializes terminal state via terminfo reset strings. It may undo palette/display state. Confirm through infocmp -1 linux and man reset.

Escape Controls

console_codes(4) is source of truth for Linux-console control sequences. Stable topics there:

  • control chars
  • ESC / CSI / OSC sequences
  • SGR attributes
  • palette controls
  • private Linux console sequences

Avoid hard-wiring controls unless the task explicitly needs raw escapes. Prefer terminfo-aware tools when possible.

Screen Memory

vcs(4) documents /dev/vcsN and /dev/vcsaN screen-memory devices. They can help inspect or dump VTs. Access depends on device permissions. Prefer setterm --dump for simple snapshots when available.

Low-level ioctls

ioctl_console(2) describes Linux-specific console/VT ioctls and warns they are internal-ish. Prefer user tools unless low-level work is requested.

# Model

## Terms

- Linux console:
  kernel console implementation.
- Virtual console / VT:
  numbered console, usually `/dev/ttyN`.
- pty:
  pseudo-terminal, usually `/dev/pts/N`; not a real VT.
- `TERM=linux`:
  terminfo name commonly used by Linux VTs.
- framebuffer console / `fbcon`:
  kernel console display path on many systems.

## Detection

Evaluate the target session, not the agent's execution context.
Strong signal from the target:

```text
/dev/ttyN + TERM=linux
```

`/dev/pts/N` identifies the probed session as a pty, not the user's separate VT.
Agent output of `/dev/pts/N` or `not a tty` leaves the target unknown.
Confirm the target host and VT; continue remote diagnosis rather than stopping.

Use exact user wording too:
`tty1`, `tty2`, `virtual console`, `linux console`, `Ctrl+Alt+F1`, `getty`,
`fbcon`.

## Terminfo

`infocmp -1 linux` shows what `clear`, `reset`, curses apps, and terminfo-aware
programs will emit.

Inspect, do not assume:

```sh
infocmp -1 linux | grep -E 'clear|rs1|rs2|rs3|oc|op|initc|sgr0'
```

## Clear vs Reset

`clear` normally clears/redraws screen state.

`reset` reinitializes terminal state via terminfo reset strings.
It may undo palette/display state.
Confirm through `infocmp -1 linux` and `man reset`.

## Escape Controls

`console_codes(4)` is source of truth for Linux-console control sequences.
Stable topics there:

- control chars
- ESC / CSI / OSC sequences
- SGR attributes
- palette controls
- private Linux console sequences

Avoid hard-wiring controls unless the task explicitly needs raw escapes.
Prefer terminfo-aware tools when possible.

## Screen Memory

`vcs(4)` documents `/dev/vcsN` and `/dev/vcsaN` screen-memory devices.
They can help inspect or dump VTs.
Access depends on device permissions.
Prefer `setterm --dump` for simple snapshots when available.

## Low-level ioctls

`ioctl_console(2)` describes Linux-specific console/VT ioctls and warns they are
internal-ish.
Prefer user tools unless low-level work is requested.