# session.Session.cmd

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

```
cmd(
  command: string,
  args: readonly string[] = [],
  options?: CmdOptions,
): Promise<readonly string[]>
```

Run a tmux command this package does not model, addressed at this session.

The first argument is the tmux command name and nothing else — this does
not parse a command line, so arguments go in the array:

The session's id is sent as the target; pass `target` to address something
else, or [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null) for a command that takes none.

## Examples

```ts
await session.cmd("rename-session", ["--", "renamed"]);
```

## Parameters

- `command` (`string`)
- `args` (`readonly string[]`)
  Default: `[]`.
- `options?` (`CmdOptions`)

## In other ports

Run a tmux command addressed at a session

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Session.cmd`](/en/py/latest/reference/libtmux-session-cmd/) (method) |
| Rust | [`session.Session.cmd`](/en/rs/latest/reference/session-session-cmd/) (method) |
| Go | [`tmux.Session.Cmd`](/en/go/latest/reference/tmux-session-cmd/) (method) |
| Java | no equivalent on `Session` |
| C# | no equivalent on `Session` |
| C++ | no equivalent on `Session` |
| Swift | no equivalent on `Session` |

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