it2 session lookup parent
Look up the parent session ID
Synopsis
it2 session lookup parent [<session-id>] [flags]
Description
Look up the parent session ID of a session (if it's a split pane).
When a session is created via splitting (horizontal or vertical), it has a parent
session ID that indicates which session it was split from. This command returns
that parent session ID.
If no session ID is provided, uses the current session from ITERM_SESSION_ID.
If the session has no parent (e.g., it's the original session in a tab), no output is returned.
Options
-
--json - Output result as JSON
-
-q,--quiet - Only output the parent session ID (for scripting)
-
-s,--short - Output only the first 8 characters of the session ID
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
- it2 session lookup - Look up session relationships and hierarchy
Examples
# Basic Usage
it2 session parent
it2 session parent sess_abc123
# Short format (first 8 characters)
it2 session parent -s
# Scripting Example
PARENT=$(it2 session parent -q)
if [ -n "$PARENT" ]; then
it2 session focus "$PARENT"
fi