On this page
pane.Pane.send_keys
- Module
- pane
- Declared in
- Pane
- Package
- libtmux
- Source
- crates/libtmux/src/pane.rs
- Other languages
- PythonTypeScriptGo Java .NETC++Swift
-
Send keys to the pane as if typed.
The text is sent literally with tmux's
-lflag, so key names such asC-care typed rather than interpreted. UsePane::send_key_namesfor 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
- Python
libtmux.Pane.send_keys - TypeScript
pane.Pane.sendKeys - Go
tmux.Pane.SendKeys - Java no direct equivalent; `Pane.paste` writes a buffer instead
- .NET
LibTmux.Pane.SendKeysAsync - C++
libtmux::Pane::send_text - Swift
Server.sendKeys(_:to:literally:)
- Python
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