it2 session run
Send text to a session and execute it (appends newline)
Synopsis
it2 session run [<session-id>] <command> [flags]
Description
Send text to a session and execute it by appending a newline.
This is a convenience wrapper around send-text that always appends a newline
character to execute the command. Equivalent to: send-text --skip-confirm
The session can be specified as a positional argument or with the -s flag.
Options
-
--allow-self - Allow running command in the same session (disabled by default for safety)
-
-s,--session - Target session ID
-
--timeout(default "1m0s") - Timeout for the command
Options inherited from parent commands
-
--format(default "text") - Output format (text, json, yaml) - affects how command results are displayed
-
--url - WebSocket URL for iTerm2 API - typically ws://localhost:1912 for local iTerm2
See Also
- it2 session - Manage iTerm2 sessions
Examples
# Run a command in a specific session (positional)
$ it2 session run 7AA9 "echo hello"
# Run a command using -s flag
$ it2 session run -s 7AA9 "echo hello"
# Run a command in the current session
$ it2 session run "ls -la"