it2 session close

Close one or more sessions

Synopsis

it2 session close [<session-id>...] [flags]

Description

Close the specified iTerm2 session(s). Use --force to close without prompting.

The session can be specified as a positional argument or with the -s flag.

Options

--dry-run

Show what would be affected without executing

--force

Force close the session without prompting

--format (default "table")

Output format (table|json|yaml|text)

--scope

Filter sessions by scope (default: all sessions). Options: none, window, tab, parents, siblings, peers, lineage. Overrides IT2_SCOPE env var.
-s, --session
Target session ID to close

--stop-on-error

Stop on first error instead of continuing

--timeout (default "5s")

Command timeout

--url (default "ws://localhost:1912")

iTerm2 WebSocket URL

See Also

Examples

# Close a specific session
$ it2 session close abc123

# Close using -s flag
$ it2 session close -s abc123

# Close multiple sessions
$ it2 session close abc123 def456 ghi789

# Close current session
$ it2 session close $ITERM_SESSION_ID

# Force close without confirmation
$ it2 session close --force abc123

# Close with JSON output
$ it2 session close --format json abc123

# Close all sessions in window
$ IT2_SCOPE=window it2 session close $(it2 session list --format id)