it2 session lookup ancestors
Look up all ancestor sessions
Synopsis
it2 session lookup ancestors [<session-id>] [flags]
Description
Look up all ancestor sessions (parent, grandparent, etc. up to root).
This command walks up the split tree from the given session and returns
all sessions that are ancestors in order from immediate parent to root.
If no session ID is provided, uses the current session from ITERM_SESSION_ID.
If the session has no ancestors (is already root), returns empty output.
Options
-
--json - Output result as JSON
-
-q,--quiet - Only output ancestor session IDs (for scripting)
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 lookup ancestors
it2 session lookup ancestors sess_abc123
# Scripting Example - Show lineage path
echo "Lineage from current to root:"
for ancestor in $(it2 session lookup ancestors -q); do
it2 session get-info "$ancestor" | grep title
done