libtmux Reference MCP Search
On this page

pane.Pane.send_keys

View as Markdown

Module
pane
Declared in
Pane
Package
libtmux
Source
crates/libtmux/src/pane.rs
Other languages
PythonTypeScriptGo Java .NETC++Swift
send_keys ( self , keys : impl Into<OsString> ) Result<(), Error>
method [source]
method [source]
send_keys

Send keys to the pane as if typed.

The text is sent literally with tmux's -l flag, so key names such as C-c are typed rather than interpreted. Use Pane::send_key_names for tmux's key vocabulary.

The text is marked sensitive, so it never reaches Debug, an error, or a tracing span: a pane is where passwords get typed.

Errors

Returns an error when tmux refuses the command.

Discussed in Pane interaction

In other languages Send keystrokes to a pane

Examples

>>> pane = window.split(shell='sh')
>>> pane.capture_pane()
['$']
>>> pane.send_keys('echo "Hello world"', enter=True)
>>> pane.capture_pane()
['$ echo "Hello world"', 'Hello world', '$']
>>> print('\n'.join(pane.capture_pane()))  # doctest: +NORMALIZE_WHITESPACE
$ echo "Hello world"
Hello world
$

Flag-only invocation — reset terminal state without sending any keys:

>>> pane.send_keys(reset=True)
await pane.sendKeys("echo hello");
await pane.sendKeys("C-c", { literal: false });

0 declared, 0 inherited

Esc

Type to search.