# libtmux:fetch-snapshot

- **Package:** libtmux
- **Language:** Common Lisp
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-lisp/blob/c2e5fc4ed3befda21f45dfa5d5868c38fd138311/src/capture.lisp#L161
- **Public owner:** libtmux
- **Page:** https://libtmux.org/en/lisp/latest/reference/libtmux-fetch-snapshot/

```
(fetch-snapshot client &key cancel-token (timeout (slot-value client (quote timeout))) (output-limit (slot-value client (quote output-limit))) (row-limit 100000) (entity-limit 100000) (field-limit 1048576))
```

Acquire an eager native graph; all later accessors on it are local.
TIMEOUT controls one acquisition deadline and OUTPUT-LIMIT caps combined output,
including at most two retries after contradictory observations. Synchronous
setup and additional cleanup can extend caller wall time. ROW-LIMIT bounds each listing;
ENTITY-LIMIT bounds the complete graph; FIELD-LIMIT bounds encoded field bytes.
No daemon is started. A live daemon with zero sessions yields empty vectors;
connection/listing failures remain errors. Closing CLIENT leaves this snapshot
usable. This is an interval observation, not a transactional snapshot.

See also: `libtmux:error-outcome`, `libtmux:fetch-panes`, `libtmux:provenance`, `libtmux:refresh`.

## Parameters

- `client`
- `cancel-token?`
- `timeout?`
- `output-limit?`
- `row-limit?`
- `entity-limit?`
- `field-limit?`

## tmux command

The tmux commands behind `fetch-snapshot`.

- [`list-panes`](/en/tmux/latest/manual/list-panes/) `-a` server scope, [`cmd_list_panes_server`](/en/tmux/latest/reference/c-function-cmd-list-panes-c-cmd_list_panes_server/) (the server has sessions) (source: `src/capture.lisp:30`)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_list_panes_entry`](/en/tmux/latest/reference/c-variable-cmd_list_panes_entry/) (attribute)
- [`cmd_list_panes_server`](/en/tmux/latest/reference/c-function-cmd-list-panes-c-cmd_list_panes_server/) (function)

## Guides

Pages that discuss `fetch-snapshot`.

### Concepts

- [Captures and identity](/en/lisp/latest/concepts/captures/)

### Examples

- [Capture pane output](/en/lisp/latest/examples/capture-pane-output/)

### Guides

- [Attaching to tmux](/en/lisp/latest/guides/attaching-to-tmux/)

## In other ports

Capture the tmux hierarchy

| Language | Equivalent |
| --- | --- |
| Python | no equivalent on `Server` |
| Ruby | [`LibTmux::Server#snapshot`](/en/ruby/latest/reference/libtmux-server-snapshot/) (method) |
| Lua | [`libtmux.Server:snapshot`](/en/lua/latest/reference/libtmux-server-snapshot/) (method) |
| PowerShell | [`LibTmux\Get-TmuxSnapshot`](/en/powershell/latest/reference/libtmux-get-tmuxsnapshot/) (cmdlet). Acquires a replacement `LibTmux.Server` to [`-Depth`](/en/powershell/latest/reference/libtmux-get-tmuxsnapshot/#LibTmux%5CGet-TmuxSnapshot.parameter.Depth) (panes by default). Acquisition is not atomic; retained handles do not refresh. |
| Julia | [`LibTmux.snapshot`](/en/julia/latest/reference/libtmux-snapshot-1gv6/) (function). Acquires a new `Snapshot` over an observation interval. Topology checks do not make it a transaction; earlier snapshots do not refresh. |
| Erlang | [`tmux_server:snapshot/1`](/en/erlang/latest/reference/tmux_server-snapshot-1/) (function). Captures a new graph over an observation interval. Retained snapshots never refresh. |
| Elixir | [`LibTmux.Server.snapshot/2`](/en/elixir/latest/reference/libtmux-server-snapshot-2/) (function). Captures a new graph over an observation interval. A retained `Snapshot` never refreshes. |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`server.Server.snapshot`](/en/ts/latest/reference/server-server-snapshot/) (method) |
| Rust | [`server.Server.hierarchy`](/en/rs/latest/reference/server-server-hierarchy/) (method). Fetches the whole hierarchy with `list-sessions`, `list-windows -a` and `list-panes -a`, and stitches the rows by winlink. The three listings are separate commands, so the capture is not an atomic transaction. |
| Go | [`tmux.Server.Snapshot`](/en/go/latest/reference/tmux-server-snapshot/) (method) |
| Java | [`io.github.libtmux.Server.snapshot`](/en/java/latest/reference/io-github-libtmux-server-server-snapshot/) (method) |
| Clojure | [`libtmux.core/snapshot!`](/en/clojure/latest/reference/libtmux-core-snapshot/) (function). Acquires a captured graph of persistent values. Retained values do not refresh after mutation or close. |
| Kotlin | [`io.github.libtmux.kotlin.Server.snapshot`](/en/kotlin/latest/reference/io-github-libtmux-kotlin-server-snapshot/) (method) |
| Scala | [`io.github.libtmux.scaladsl.Server.snapshot`](/en/scala/latest/reference/io-github-libtmux-scaladsl-server-snapshot/) (method) |
| C# | [`LibTmux.Server.CaptureSnapshotAsync`](/en/csharp/latest/reference/libtmux-server-capturesnapshotasync/) (method) |
| F# | [`LibTmux.FSharp.Server.capture`](/en/fsharp/latest/reference/libtmux-fsharp-server-capture/) (function). Acquires a replacement shared .NET `LibTmux.Server` to the requested depth. Acquisition is not atomic; retained handles do not refresh. |
| C++ | no equivalent on `Server`: `sessions`, `windows`, `panes` and `clients` each take a snapshot of one listing, and `Snapshot::take` needs the internal `detail::Backend`, so no public call reads the whole hierarchy at once |
| Swift | [`Server.snapshot()`](/en/swift/latest/reference/server-snapshot()/) (method) |
| OCaml | [`Libtmux_unix.Client.capture`](/en/ocaml/latest/reference/libtmux_unix-client-capture/) (function). Acquires a complete immutable graph over an interval. Earlier observations remain readable without refreshing. |
| Perl | [`LibTmux::Server::snapshot`](/en/perl/latest/reference/libtmux-server-snapshot/) (method). Strict acquisition observes an interval, not an atomic transaction; retained handles do not refresh. |
