# LibTmux::Server::snapshot

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Perl
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-perl/blob/352715a4fa66a96eed7763b90daaa536aa2f121d/packages/core/lib/LibTmux/Server.pm#L1000
- **Page:** https://libtmux.org/en/perl/latest/reference/libtmux-server-snapshot/

```
sub snapshot($self, %args)
```

`snapshot()`.

Perform strict graph acquisition and return [`LibTmux::Snapshot`](/en/perl/latest/reference/libtmux-snapshot/). Physical windows/panes appear once; [`LibTmux::WindowLink`](/en/perl/latest/reference/libtmux-windowlink/) retains each contextual association. Capture start/end describe an observation interval, not an atomic transaction. Acquisition, unsupported capabilities, and incomplete topology throw typed [`LibTmux::X`](/en/perl/latest/reference/libtmux-x/); no partial snapshot is returned.


```perl
    my $snapshot = $server->snapshot;
```

## Methods

## Parameters

- `args`

## tmux command

The tmux commands behind `snapshot`.

- [`display-message`](/en/tmux/latest/manual/display-message/) (daemon identity or target preflight)
- [`list-clients`](/en/tmux/latest/manual/list-clients/)
- [`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/) (source: `packages/core/lib/LibTmux/Server.pm:955`)
- [`list-sessions`](/en/tmux/latest/manual/list-sessions/)
- [`list-windows`](/en/tmux/latest/manual/list-windows/) `-a` server scope, [`cmd_list_windows_exec`](/en/tmux/latest/reference/c-function-cmd-list-windows-c-cmd_list_windows_exec/) (source: `packages/core/lib/LibTmux/Server.pm:955`)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_display_message_entry`](/en/tmux/latest/reference/c-variable-cmd_display_message_entry/) (attribute)
- [`cmd_display_message_exec`](/en/tmux/latest/reference/c-function-cmd-display-message-c-cmd_display_message_exec/) (function)
- [`cmd_list_clients_entry`](/en/tmux/latest/reference/c-variable-cmd_list_clients_entry/) (attribute)
- [`cmd_list_clients_exec`](/en/tmux/latest/reference/c-function-cmd-list-clients-c-cmd_list_clients_exec/) (function)
- [`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)
- [`cmd_list_sessions_entry`](/en/tmux/latest/reference/c-variable-cmd_list_sessions_entry/) (attribute)
- [`cmd_list_sessions_exec`](/en/tmux/latest/reference/c-function-cmd-list-sessions-c-cmd_list_sessions_exec/) (function)
- [`cmd_list_windows_entry`](/en/tmux/latest/reference/c-variable-cmd_list_windows_entry/) (attribute)
- [`cmd_list_windows_exec`](/en/tmux/latest/reference/c-function-cmd-list-windows-c-cmd_list_windows_exec/) (function)

## 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. |
| Common Lisp | [`libtmux:fetch-snapshot`](/en/lisp/latest/reference/libtmux-fetch-snapshot/) (function). `fetch-snapshot` acquires a new interval observation. Retained snapshots never refresh in place. |
| 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. |
