it2 session monitor

Monitor session events in real-time

Synopsis

it2 session monitor <session-id> [flags]

Description

Monitor a session for various events in real-time.

This command subscribes to session notifications and displays them as they occur.

Session-specific event types: [prompt keystroke screen variable escape]

  • prompt: Shell prompt changes (requires Shell Integration)
  • keystroke: Individual keystrokes
  • screen: Screen content updates
  • variable: Session variable changes
  • escape: Custom escape sequences

Global event types (ignore session parameter): [new-session terminate-session layout-change focus-change server-rpc broadcast-change profile-change]

  • new-session: New sessions created
  • terminate-session: Sessions terminated
  • layout-change: Window/tab layout changes
  • focus-change: Focus changes between sessions
  • server-rpc: Server-originated RPC calls
  • broadcast-change: Broadcast domain changes
  • profile-change: Profile changes

Special keywords:

  • all: Subscribe to all event types

Multiple event types can be specified with comma-separated values.

The command will run until interrupted (Ctrl+C).

Options

--events

Event types to monitor: prompt, keystroke, screen, variable, escape, new-session, terminate-session, layout-change, focus-change, server-rpc, broadcast-change, profile-change, or 'all' for all types

--follow-children

Automatically follow child sessions spawned from the monitored session

--follow-prompts

Monitor only prompt events (shortcut for --events=prompt)

--include-output

Include command output in prompt events (requires --json)

--json

Output events as JSON
-v, --verbose
Output complete raw protobuf notification as JSON

Options inherited from parent commands

--format (default "text")

Output format (text, json, yaml) - affects how command results are displayed

--timeout

Timeout for API operations - how long to wait for iTerm2 to respond

--url

WebSocket URL for iTerm2 API - typically ws://localhost:1912 for local iTerm2

See Also