^[control-codes
live in libghostty-vt

Operating system commands

OSC 46 Change Log File

View as Markdown

Tell xterm which file to log its session to, in a build that can log.

OSC 46 ; Pt ST
ECMA-48
§8.3.89 OSC – Operating System Command, p. 51
xterm
Operating System Commands

xterm can copy everything it receives to a log file, and OSC 46 ; Pt ST names that file. Logging is turned on with the private mode CSI ? 46 h or from xterm’s menu.

Both are compiled out of a default xterm: logging needs --enable-logging (configure.in), and without it OSC 46 is not one of the numbers xterm acts on. Even a build with logging does not let a program choose the file unless it was also built with ALLOWLOGFILECHANGES, since that would let anything written to the terminal overwrite any file its user can; otherwise it rings the bell twice (do_osc).

libghostty-vt has no OSC 46, and ignores it as a default xterm does, so the case passes.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984NoOSC is not among the controls it recognizes (§4.2)
VT510manual, 1st ed., 1993Noignores an OSC string (chapter 4)
xtermpatch 412, xterm-411aNocompiled out unless built with --enable-logging
libghostty-vt0f171f6Noignored
Konsole26.11.70, a24c3d71Nonot in its source
ConEmubuild 230724, its documentationNonot in its ANSI escape codes

Validation

OSC46-1: Ignored

A
\e]46;/tmp/session.log\a
B
|AB____|
cursor 1,3
reply none
bell 0
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.