# Libtmux_unix.Client.kill_session

- **Module:** Libtmux_unix
- **Package:** libtmux-unix
- **Language:** OCaml
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ocaml/blob/205dfda49742592b479247049d186956e4a4cfe9/unix/libtmux_unix.mli#L581
- **Public owner:** Libtmux_unix
- **Page:** https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-client-kill_session/

```
val kill_session :
  ?cancel:Cancellation.t ->
  t -> Libtmux.Session.target -> (unit, Libtmux.Error.t) result
```

Remove the session and its window links. Windows with no other links and their panes are destroyed. Removing the last session may stop tmux.

## Parameters

- `cancel?` (`Cancellation.t`)
- `arg1` (`t`)
- `arg2` (`Libtmux.Session.target`)

## tmux command

The tmux commands behind `kill_session`.

- [`kill-session`](/en/tmux/latest/manual/kill-session/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_kill_session_entry`](/en/tmux/latest/reference/c-variable-cmd_kill_session_entry/) (attribute)
- [`cmd_kill_session_exec`](/en/tmux/latest/reference/c-function-cmd-kill-session-c-cmd_kill_session_exec/) (function)

## In other ports

End a session

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Session.kill`](/en/py/latest/reference/libtmux-session-kill/) (method) |
| Ruby | [`LibTmux::Session#kill`](/en/ruby/latest/reference/libtmux-session-kill/) (method) |
| Lua | [`libtmux.Session:kill`](/en/lua/latest/reference/libtmux-session-kill/) (method) |
| Erlang | [`tmux_session:kill/1`](/en/erlang/latest/reference/tmux_session-kill-1/) (function) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`session.Session.kill`](/en/ts/latest/reference/session-session-kill/) (method) |
| Rust | [`session.Session.kill`](/en/rs/latest/reference/session-session-kill/) (method) |
| Go | [`tmux.Session.Kill`](/en/go/latest/reference/tmux-session-kill/) (method) |
| Java | [`io.github.libtmux.Session.kill`](/en/java/latest/reference/io-github-libtmux-session-session-kill/) (method) |
| C# | [`LibTmux.Session.KillAsync`](/en/csharp/latest/reference/libtmux-session-killasync/) (method) |
| C++ | [`libtmux::Session::kill`](/en/cxx/latest/reference/libtmux-session-kill/) (method) |
| Swift | [`Server.kill(_:)`](/en/swift/latest/reference/server-kill(_-)/) (method) |
| Perl | [`LibTmux::Server::kill_session`](/en/perl/latest/reference/libtmux-server-kill_session/) (method). Explicit Server operation. Captured entities remain local observations; use a new snapshot to observe changes. |

No equivalent is recorded in PowerShell, Julia, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.
