# tmux run-shell

Source: https://libtmux.org/en/tmux/3.2a/manual/run-shell/

> Execute shell-command or (with -C) a tmux command in the background without creating a window.

Execute shell-command or (with -C) a tmux command in the background without creating a window.

## Syntax

```tmux-usage
tmux run-shell [-bC] [-d delay] [-t target-pane] [shell-command]
```

Alias: `run`.

## Behavior

Execute `shell-command` or (with `-C`) a `tmux` command in the background without creating a window. Before being executed, `shell-command` is expanded using the rules specified in the [FORMATS](https://libtmux.org/en/tmux/3.2a/manual/full/#FORMATS) section. With `-b`, the command is run in the background. `-d` waits for `delay` seconds before starting the command. If `-C` is not given, any output to stdout is displayed in view mode (in the pane specified by `-t` or the current pane if omitted) after the command finishes. If the command fails, the exit status is also displayed.

## C implementation

Internal declarations in tmux 3.2a:

* [`cmd_run_shell_entry`](https://libtmux.org/en/tmux/3.2a/reference/c-variable-cmd_run_shell_entry/)
* [`cmd_run_shell_exec`](https://libtmux.org/en/tmux/3.2a/reference/c-function-cmd-run-shell-c-cmd_run_shell_exec/)

## Use from a library

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

* [Python](https://libtmux.org/en/py/latest/reference/libtmux-server-run_shell/)
* [TypeScript](https://libtmux.org/en/ts/latest/reference/server-server-runshell/)
* [Rust](https://libtmux.org/en/rs/latest/reference/server-server-run_shell/)
* [Go](https://libtmux.org/en/go/latest/reference/tmux-server-runshell/)
* [Java](https://libtmux.org/en/java/latest/reference/io-github-libtmux-shell-shell-run/)
* [C#](https://libtmux.org/en/csharp/latest/reference/libtmux-server-runshellasync/)
* [C++](https://libtmux.org/en/cxx/latest/reference/libtmux-server-run_shell/)
* [Ruby](https://libtmux.org/en/ruby/latest/reference/libtmux-server-run/)

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-run-shell.c#L41)

```
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.
```
