# tmux send-keys

Source: https://libtmux.org/en/tmux/3.2a/manual/send-keys/

> Send a key or keys to a window.

Send a key or keys to a window.

## Syntax

```tmux-usage
tmux send-keys [-FHlMRX] [-N repeat-count] [-t target-pane] key ...
```

Alias: `send`.

## Behavior

Send a key or keys to a window. Each argument `key` is the name of the key (such as ‘`C-a`’ or ‘`NPage`’) to send; if the string is not recognised as a key, it is sent as a series of characters. All arguments are sent sequentially from first to last.

The `-l` flag disables key name lookup and processes the keys as literal UTF-8 characters. The `-H` flag expects each key to be a hexadecimal number for an ASCII character.

The `-R` flag causes the terminal state to be reset.

`-M` passes through a mouse event (only valid if bound to a mouse key binding, see [MOUSE SUPPORT](https://libtmux.org/en/tmux/3.2a/manual/full/#MOUSE_SUPPORT)).

`-X` is used to send a command into copy mode - see the [WINDOWS AND PANES](https://libtmux.org/en/tmux/3.2a/manual/full/#WINDOWS_AND_PANES) section. `-N` specifies a repeat count and `-F` expands formats in arguments where appropriate.

## Guides

* [Send input to a pane](https://libtmux.org/en/tmux/guides/sending-keys/)

## C implementation

Internal declarations in tmux 3.2a:

* [`cmd_send_keys_entry`](https://libtmux.org/en/tmux/3.2a/reference/c-variable-cmd_send_keys_entry/)
* [`cmd_send_keys_exec`](https://libtmux.org/en/tmux/3.2a/reference/c-function-cmd-send-keys-c-cmd_send_keys_exec/)

## Use from a library

Each API describes its own defaults, errors and execution model.

* [Scala](https://libtmux.org/en/scala/latest/reference/io-github-libtmux-scaladsl-pane-sendkeys/)
* [Kotlin](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-pane-sendkeys/)
* [Python](https://libtmux.org/en/py/latest/reference/libtmux-pane-send_keys/)
* [TypeScript](https://libtmux.org/en/ts/latest/reference/pane-pane-sendkeys/)
* [Rust](https://libtmux.org/en/rs/latest/reference/pane-pane-send_keys/)
* [Go](https://libtmux.org/en/go/latest/reference/tmux-pane-sendkeys/)
* [C#](https://libtmux.org/en/csharp/latest/reference/libtmux-pane-sendkeysasync/)
* [C++](https://libtmux.org/en/cxx/latest/reference/libtmux-pane-send_text/)
* [Swift](https://libtmux.org/en/swift/latest/reference/server-sendkeys\(_-to-literally-\)/)
* [Ruby](https://libtmux.org/en/ruby/latest/reference/libtmux-pane-send_keys/)
* [Lua](https://libtmux.org/en/lua/latest/reference/libtmux-pane-send_keys/)

tmux sources and license

Syntax comes from `tmux 3.2a list-commands`. See the [global options](https://libtmux.org/en/tmux/3.2a/manual/full/#DESCRIPTION) for sockets and configuration, and [command syntax and targets](https://libtmux.org/en/tmux/3.2a/manual/full/#COMMANDS).

Behavior is taken from the [tmux 3.2a manual](https://github.com/tmux/tmux/blob/85893888497c5077979bc7557fb970ee5e3d13d9/tmux.1).

[Command declaration](https://github.com/tmux/tmux/blob/85893888497c5077979bc7557fb970ee5e3d13d9/cmd-send-keys.c#L33)

```
Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
