it2 session focus

Focus/activate a session

Synopsis

it2 session focus [<session-id>] [flags]

Description

Activate and focus the specified iTerm2 session, bringing it to front.

Examples

# Focus a specific session (brings it to front and selects it)
$ it2 session focus abc123
# Focus current session (refresh/ensure focus)
$ it2 session focus
# Focus without selecting in tab
$ it2 session focus --select-session=false abc123
# Focus with JSON output
$ it2 session focus --format json abc123
# Focus session by partial ID match
$ it2 session focus abc
# Focus most recently created session
$ it2 session focus $(it2 session list --format id | head -1)
# Switch between two sessions quickly
$ SESS1=$(it2 session current)
$ it2 session focus other-session-id
$ it2 session focus $SESS1  # Switch back

Options

--focus-tab

Switch to the tab containing the session

--focus-window

Bring the window containing the session to front

--format (default "table")

Output format (table|json|yaml|text)

--timeout (default "5s")

Command timeout

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

iTerm2 WebSocket URL

See Also