it2 session restart

Restart a session

Synopsis

it2 session restart <session-id> [flags]

Description

Restart a session, optionally only if it has already exited

Examples

# Restart a crashed or exited session
$ it2 session restart abc123
# Only restart if session has already exited
$ it2 session restart --only-if-exited abc123
# Restart current session
$ it2 session restart $ITERM_SESSION_ID
# Restart all exited sessions in window
$ for sid in $(it2 session list --format id); do
$ it2 session restart --only-if-exited $sid 2>/dev/null
$ done
# Restart session with custom timeout
$ it2 session restart --timeout 10s abc123

Options

--dry-run

Show what would be affected without executing

--only-if-exited

Only restart the session if it has already exited

--scope

Override IT2_SCOPE env var (none,window,tab,parents,siblings,peers,lineage)

--stop-on-error

Stop on first error instead of continuing

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