wire / terminal-osc / 7
OSC 7 ; file://host/path ST tells the terminal the shell's current working directory as a file URL. Terminals use it to open new tabs/splits in the same directory and to resolve relative paths in hyperlinks. Emitted by the shell from a precmd/PROMPT_COMMAND hook. Originated with iTerm2; now broadly supported.
aka: report cwd · current working directory · OSC 7 · ESC ] 7 · cwd reporting
OSC introducer: \x1b] ESC ] (0x1B 0x5D)
terminator (ST|BEL): ST \x1b\ · BEL \x07
| id | name | bytes (ST) | meaning |
|---|---|---|---|
| set | Report cwd | \x1b]7;file://myhost/home/user/project\x1b\ | OSC 7 ; file://HOST/PATH ST reports the shell's current working directory. HOST is the hostname (so the terminal can tell local vs remote/ssh) and PATH is the absolute, percent-encoded path. The shell emits this from precmd / PROMPT_COMMAND after each directory change. |
| terminal | level | since | notes |
|---|---|---|---|
| iTerm2 | full | documented | Origin of OSC 7 cwd reporting; opens new sessions in the reported directory. |
| VTE / GNOME Terminal | full | VTE 0.38+ | Uses the file:// URI to spawn new terminals in the same directory. |
| WezTerm | full | documented | Reads OSC 7 to spawn tabs/panes in the current directory. |
| kitty | full | documented | Honors OSC 7 for new-window cwd inheritance. |
| Windows Terminal | full | documented | Uses OSC 7 to duplicate tabs in the same working directory. |
per-fact attribution:
agent: curl -H 'accept: application/json' wire.phall.io/terminal-osc/7
or /terminal-osc/7.json