# libtmux.Pane.kill

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/38e368c11117fb4aeb2f082d552cd4f210eae06a/src/libtmux/pane.py#L999
- **Page:** https://libtmux.org/en/py/stable/reference/libtmux-pane-kill/

tmux command: [`kill-pane`](/en/tmux/latest/manual/kill-pane/)

```
libtmux.Pane.kill(
    self, all_except: bool | None = None
) -> None
```

Kill :class:`Pane`.

[`$ tmux kill-pane`](/en/tmux/latest/manual/kill-pane/).

## Examples

Kill a pane:

```python
>>> pane_1 = pane.split()
```

```python
>>> pane_1 in window.panes
True
```

```python
>>> pane_1.kill()
```

```python
>>> pane_1 not in window.panes
True
```

Kill all panes except the current one:

```python
>>> pane.window.resize(height=100, width=100)
Window(@1 1...)
```

```python
>>> one_pane_to_rule_them_all = pane.split()
```

```python
>>> other_panes = pane.split(
...     ), pane.split()
```

```python
>>> all([p in window.panes for p in other_panes])
True
```

```python
>>> one_pane_to_rule_them_all.kill(all_except=True)
```

```python
>>> all([p not in window.panes for p in other_panes])
True
```

```python
>>> one_pane_to_rule_them_all in window.panes
True
```

## Parameters

- `all_except` (`bool | None`)

## In other ports

### Close a pane

- Ruby: [`LibTmux::Pane#kill`](/en/ruby/latest/reference/libtmux-pane-kill/) (method)
- Lua: [`libtmux.Pane:kill`](/en/lua/latest/reference/libtmux-pane-kill/) (method)
- TypeScript: [`pane.Pane.kill`](/en/ts/latest/reference/pane-pane-kill/) (method)
- Rust: [`pane.Pane.kill`](/en/rs/latest/reference/pane-pane-kill/) (method)
- Go: [`tmux.Pane.Kill`](/en/go/latest/reference/tmux-pane-kill/) (method)
- Java: [`io.github.libtmux.Pane.Pane.kill`](/en/java/latest/reference/io-github-libtmux-pane-pane-kill/) (method)
- C#: [`LibTmux.Pane.KillAsync`](/en/csharp/latest/reference/libtmux-pane-killasync/) (method)
- C++: [`libtmux::Pane::kill`](/en/cxx/latest/reference/libtmux-pane-kill/) (method)
- Swift: [`Server.kill(_:)`](/en/swift/latest/reference/server-kill(_-)/) (method)
