# libtmux.common.tmux_cmd

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

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

## Example

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

## Example

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

## Members

- `__init__` (method)
