Tmux

Send Keys to Process in New Pane


# Start a process in a new pane, assigning its pane ID to a variable.
id=$(tmux split-window -P -F "#{pane_id}" 'command')

# Send key sequence to pane by ID.
tmux send-keys -t "$id" 'key sequence' ^M

Capture Output of Process in New Pane


# Start a process in a new pane, assigning its pane ID to a variable.
id=$(tmux split-window -P -F "#{pane_id}" 'command')

# Capture contents of pane to buffer by ID.
tmux capture-pane -t "$id"

# Print the buffer to stdout.
tmux show-buffer | grep whatever # Then grep and cut whatever is needed.