# libtmux.common.tmux_cmd

- **Module:** libtmux.common
- **Package:** libtmux
- **Language:** Python
- **Kind:** class
- **Source:** https://github.com/tmux-python/libtmux/blob/38e368c11117fb4aeb2f082d552cd4f210eae06a/src/libtmux/common.py#L283
- **Page:** https://libtmux.org/en/py/stable/reference/libtmux-common-tmux_cmd/

Run any :term:`tmux(1)` command through :py:mod:`subprocess`.

## Examples

Create a new session, check for error:

```python
>>> proc = tmux_cmd(f'-L{server.socket_name}', 'new-session', '-d', '-P', '-F#S')
>>> if proc.stderr:
...     raise exc.LibTmuxException(
...         'Command: %s returned error: %s' % (proc.cmd, proc.stderr)
...     )
...
```

```python
>>> print(f'tmux command returned {" ".join(proc.stdout)}')
tmux command returned 2
```

## Changed

0.8 — Renamed from ``tmux`` to ``tmux_cmd``.

## Members

### Other members

- [`__init__`](/en/py/stable/reference/libtmux-common-tmux_cmd-__init__/) (method)
