it2 session get-screen
Get current screen contents of a session
Synopsis
it2 session get-screen [<session-id>] [flags]
Description
Get the current visible screen contents of a session without scrollback history.
If no session-id is provided, uses $ITERM_SESSION_ID environment variable.
Use --wait-stable to wait until the screen contents stabilize before capturing.
This is useful for automation scenarios where you need to wait for command output
to complete before capturing the screen.
Stability options:
--wait-stable - Normal tolerance (2s), max-wait 10s
--wait-stable --wait-stable-tolerance=low - Quick detection (500ms), max-wait 10s
--wait-stable --wait-stable-tolerance=high - Lenient (5s), max-wait 10s
--wait-stable --wait-stable-max-wait=30s - Normal tolerance (2s), but max 30s total
Examples:
Get immediate screen contents
it2 session get-screen E0A8
Wait for screen to stabilize before capturing (default 2s)
it2 session get-screen E0A8 --wait-stable
Quick detection with low tolerance (500ms)
it2 session get-screen E0A8 --wait-stable --wait-stable-tolerance=low
Lenient detection with high tolerance (5s)
it2 session get-screen E0A8 --wait-stable --wait-stable-tolerance=high
Wait with custom max timeout
it2 session get-screen E0A8 --wait-stable --wait-stable-max-wait=30s
Replaces the pattern: sleep 5 && it2 session get-screen E0A8
it2 session send-text E0A8 "long-running-command"
it2 session get-screen E0A8 --wait-stable | tail -20
Options
-
--allow-self - Allow reading screen from the same session (disabled by default for safety)
-
--color - Include ANSI color codes in output
-
--escaped - Show escape sequences as visible characters (like cat -v)
-
--format(default "table") - Output format (table|json|yaml|text)
-
--poll-interval(default "200ms") - Interval between screen polls when waiting for stability
-
--timeout(default "5s") - Command timeout
-
--url(default "ws://localhost:1912") - iTerm2 WebSocket URL
-
--wait-stable - Wait until screen is stable (uses --wait-stable-tolerance for timing)
-
--wait-stable-max-wait(default "10s") - Maximum total time to wait for stability (default: 10s). 0 for no limit
-
--wait-stable-tolerance(default "normal") - Stability tolerance level: low (500ms), normal (2s), high (5s)
See Also
- it2 session - Manage iTerm2 sessions