# server.Server.runShell

- **Module:** server
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/server.ts#L1501
- **Page:** https://libtmux.org/en/ts/latest/reference/server-server-runshell/

```
runShell(
  command: string,
  options?: RunShellOptions,
): Promise<readonly string[]>
```

Run a shell command through tmux and return whatever it printed.

`signal` and [`timeoutMs`](/en/ts/latest/reference/server-serveroptions-timeoutms/) bound this call's own wait; the tmux server owns
and runs [`run-shell`](/en/tmux/latest/manual/run-shell/) itself, decoupled from this client, so neither one
stops the command - only this call's own promise settling early.

Requires tmux 3.5 or newer. tmux 3.3a and 3.4 print a clientless
[`run-shell`](/en/tmux/latest/manual/run-shell/)'s output to a view-mode pane, so they raise
[`VersionTooLowError`](/en/ts/latest/reference/errors-versiontoolowerror/); [`cmd`](/en/ts/latest/reference/server-server-cmd/)`("run-shell", …)` runs the command there
without its output.

## Examples

```ts
const lines = await server.runShell("echo hello");
lines[0]; // "hello"
```

## Parameters

- `command` (`string`)
- `options?` (`RunShellOptions`)

## tmux command

The tmux commands behind `runShell`.

- [`run-shell`](/en/tmux/latest/manual/run-shell/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_run_shell_entry`](/en/tmux/latest/reference/c-variable-cmd_run_shell_entry/) (attribute)
- [`cmd_run_shell_exec`](/en/tmux/latest/reference/c-function-cmd-run-shell-c-cmd_run_shell_exec/) (function)

## In other ports

Run a shell command through tmux

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Server.run_shell`](/en/py/latest/reference/libtmux-server-run_shell/) (method) |
| Ruby | [`LibTmux::Server#run`](/en/ruby/latest/reference/libtmux-server-run/) (method) |
| Rust | [`server.Server.run_shell`](/en/rs/latest/reference/server-server-run_shell/) (method) |
| Go | [`tmux.Server.RunShell`](/en/go/latest/reference/tmux-server-runshell/) (method) |
| Java | [`io.github.libtmux.Shell.run`](/en/java/latest/reference/io-github-libtmux-shell-shell-run/) (method) |
| C# | [`LibTmux.Server.RunShellAsync`](/en/csharp/latest/reference/libtmux-server-runshellasync/) (method) |
| C++ | [`libtmux::Server::run_shell`](/en/cxx/latest/reference/libtmux-server-run_shell/) (method) |
| Swift | `Server.run(_:in:)` types a command into a pane rather than running it on the host |

No equivalent is recorded in Lua, PowerShell, Julia, Elixir, Kotlin, Scala or F#.
