# tmux_pane:capture/2

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_pane.erl#L414
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_pane-capture-2/

```
capture(Pane, Options)
-spec capture(tmux_model:pane(), capture_options()) ->
                 {ok, binary()} | {error, map()}.
```

Capture terminal bytes, preserving final newlines. Options select line range, joined wraps, escapes, alternate screen and padding; defaults follow tmux current-screen capture. Performs I/O and returns an explicit output-limit error instead of silently truncating.

## Parameters

- `Pane` (`tmux_model:pane()`)
- `Options` (`capture_options()`)

## tmux command

The tmux commands behind `capture/2`.

- [`capture-pane`](/en/tmux/latest/manual/capture-pane/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_capture_pane_entry`](/en/tmux/latest/reference/c-variable-cmd_capture_pane_entry/) (attribute)
- [`cmd_capture_pane_exec`](/en/tmux/latest/reference/c-function-cmd-capture-pane-c-cmd_capture_pane_exec/) (function)

## In other ports

Read a pane’s visible contents

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Pane.capture_pane`](/en/py/latest/reference/libtmux-pane-capture_pane/) (method) |
| Ruby | [`LibTmux::Pane#capture`](/en/ruby/latest/reference/libtmux-pane-capture/) (method) |
| Lua | [`libtmux.Pane:capture`](/en/lua/latest/reference/libtmux-pane-capture/) (method) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`pane.Pane.capture`](/en/ts/latest/reference/pane-pane-capture/) (method) |
| Rust | [`pane.Pane.capture`](/en/rs/latest/reference/pane-pane-capture/) (method) |
| Go | [`tmux.Pane.Capture`](/en/go/latest/reference/tmux-pane-capture/) (method) |
| Java | [`io.github.libtmux.Pane.capture`](/en/java/latest/reference/io-github-libtmux-pane-pane-capture/) (method) |
| Clojure | [`libtmux.core/capture!`](/en/clojure/latest/reference/libtmux-core-capture/) (function) |
| Kotlin | [`io.github.libtmux.kotlin.Pane.capture`](/en/kotlin/latest/reference/io-github-libtmux-kotlin-pane-capture/) (method) |
| Scala | [`io.github.libtmux.scaladsl.Pane.capture`](/en/scala/latest/reference/io-github-libtmux-scaladsl-pane-capture/) (method) |
| C# | [`LibTmux.Pane.CaptureAsync`](/en/csharp/latest/reference/libtmux-pane-captureasync/) (method) |
| F# | [`LibTmux.FSharp.Pane.capture`](/en/fsharp/latest/reference/libtmux-fsharp-pane-capture/) (function) |
| C++ | [`libtmux::Pane::capture`](/en/cxx/latest/reference/libtmux-pane-capture/) (method) |
| Swift | [`Server.capture(_:includingHistory:)`](/en/swift/latest/reference/server-capture(_-includinghistory-)/) (method) |
| OCaml | [`Libtmux_unix.Client.capture_text`](/en/ocaml/latest/reference/libtmux_unix-client-capture_text/) (function) |
| Perl | [`LibTmux::Server::capture_pane`](/en/perl/latest/reference/libtmux-server-capture_pane/) (method). Explicit Server operation. Captured entities remain local observations; use a new snapshot to observe changes. |

No equivalent is recorded in PowerShell, Julia, Elixir or Common Lisp.
