it2 text send

Send text (moved to 'session send-text')

Synopsis

it2 text send <session-id> <text> [flags]

Description

This command has moved to 'session send-text'. Please use 'it2 session send-text --skip-confirm' instead.

Options

--allow-self

Allow sending text to the same session (disabled by default for safety)

--confirm

Prompt for confirmation before sending text

--delay-before-terminator (default "90ms")

Delay before sending line terminator
-f, --file
Read text from file (use '-' for stdin)

--require

Pre-condition plugins to check before sending (comma-separated or multiple flags, e.g., 'is-at-prompt,has-no-partial-input')

--require-timeout (default "10s")

Timeout for pre-condition checks

--retry (default 0)

Number of retry attempts for failed deliveries (only retries on exit codes 2 and 3)

--retry-delay (default "1s")

Delay between retry attempts
-r, --send-cr (default true)
Send carriage return (\r) to execute command (enabled by default)

--send-lf

Send line feed (\n) to move to new line

--skip-confirm

Skip text delivery confirmation (confirmation is enabled by default)

--skip-newline

Don't send any line terminator

--template

Go text/template to wrap the text (variables: Content, SessionID, ShortID, Timestamp)

--verbose

Print pre-condition status messages

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 text - Text and buffer operations in iTerm2

Examples

# Send to specific session (full UUID)
$ it2 session send-text 7AA97682-C080-4D65-8C19-FDEF4669AA84 'hello world'

# Send using partial session ID (4+ characters, case-insensitive)
$ it2 session send-text 7AA9 'hello world'
$ it2 session send-text 6b1a 'test message'

# Send text without any line terminator
$ it2 session send-text 7AA9 --skip-newline 'partial text'

# Send command with carriage return for execution
$ it2 session send-text 7AA9 --send-return 'ls -la'

# Wait for session to have no partial input before sending
$ it2 session send-text 7AA9 --require has-no-partial-input 'ls -la'

# Multiple pre-conditions (comma-separated)
$ it2 session send-text 7AA9 --require is-at-prompt,has-no-partial-input 'pwd'

# Multiple pre-conditions (multiple flags or comma-separated)
$ it2 session send-text 7AA9 --require is-at-prompt --require has-no-partial-input --require-timeout 30s 'pwd'

# Multiple conditions for Claude sessions
$ it2 session send-text 7AA9 --require is-claude-session,is-at-prompt,is-at-empty-prompt,has-no-queued-messages 'your command'

# Retry on transient failures (exits 2 or 3)
$ it2 session send-text 7AA9 --retry 3 --retry-delay 2s 'command'

# Skip confirmation for speed (when you don't need verification)
$ it2 session send-text 7AA9 --skip-confirm 'command'

# Debug delivery issues
$ IT2_DEBUG_DELIVERY=1 it2 session send-text 7AA9 'test'

# Send from file
$ it2 session send-text 7AA9 -f file.txt

# Send from stdin
$ printf '\\r' | it2 session send-text 7AA9 -

# Send escape character (for vim, etc.)
$ it2 session send-text 7AA9 $'\x1b'

# Send control characters
$ it2 session send-text 7AA9 $'\x03'  # Ctrl+C
$ it2 session send-text 7AA9 $'\x04'  # Ctrl+D

# Send vim commands with escape
$ it2 session send-text 7AA9 $'\x1b:w\n'  # ESC + :w + Enter

# Send vim commands with force quit
$ it2 session send-text 7AA9 $'\x1b:q\x21\n'  # ESC + :q! + Enter

# Alternative methods for exclamation mark
$ it2 session send-text 7AA9 ':q!'         # Single quotes protect
$ it2 session send-text 7AA9 ':q\!'        # Backslash escape

# Template wrapping for structured messaging
$ it2 session send-text 7AA9 --template '<msg from="{{.ShortID}}">{{.Content}}</msg>' "hello"

# JSON formatting with timestamp
$ it2 session send-text 7AA9 --template '{"text":"{{.Content}}","session":"{{.SessionID}}","ts":"{{.Timestamp}}"}' "status update"

# XML message with metadata
$ it2 session send-text 7AA9 --template '<message session="{{.ShortID}}" time="{{.Timestamp}}">{{.Content}}</message>' "deploy complete"

# Simple prefix/suffix wrapping
$ it2 session send-text 7AA9 --template '[{{.ShortID}}] {{.Content}}' "log message"