# LibTmux.Snapshot.sessions/1

- **Module:** LibTmux
- **Package:** libtmux
- **Language:** Elixir
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-elixir/blob/5bacf40788b43a5af27bb3656e727a921ba2db40/lib/libtmux/snapshot.ex#L170
- **Page:** https://libtmux.org/en/elixir/pr-173/reference/libtmux-snapshot-sessions-1/

```
sessions(snapshot)
@spec sessions(t()) ::
        LibTmux.Selection.t(LibTmux.Session.t())
```

Returns a materialized session selection without I/O.

See the [worked example](api-examples.html#local-graph-and-filtering).

## Parameters

- `snapshot` (`t()`)

## Guides

Pages that discuss `sessions/1`.

- [Attaching to tmux](/en/elixir/pr-173/guides/attaching-to-tmux/)

## In other ports

List the server’s sessions

| Port | API | Differs from Elixir |
| --- | --- | --- |
| Elixir | `LibTmux.Snapshot.sessions/1`. Returns a materialized session selection without I/O. | This page |
| Python | [`libtmux.Server.sessions`](/en/py/latest/reference/libtmux-server-sessions/) (property). Sessions contained in server. | None recorded in the model |
| Ruby | [`LibTmux::Server#list_sessions`](/en/ruby/latest/reference/libtmux-server-list_sessions/) (method). Behavior: Live acquisition. | on Server |
| Lua | [`libtmux.Snapshot.sessions`](/en/lua/latest/reference/libtmux-snapshot-sessions/) (attribute) | None recorded in the model |
| PowerShell | [`LibTmux\Get-TmuxSession`](/en/powershell/latest/reference/libtmux-get-tmuxsession/) (cmdlet). Read sessions with optional exact selectors. | free function. Acquires sessions through [`-Server`](/en/powershell/latest/reference/libtmux-get-tmuxsession/#LibTmux%5CGet-TmuxSession.parameter.Server), with optional exact [`-Id`](/en/powershell/latest/reference/libtmux-get-tmuxsession/#LibTmux%5CGet-TmuxSession.parameter.Id) and [`-Name`](/en/powershell/latest/reference/libtmux-get-tmuxsession/#LibTmux%5CGet-TmuxSession.parameter.Name) selectors. |
| Julia | [`LibTmux.sessions`](/en/julia/latest/reference/libtmux-sessions/) (function) | free function. `sessions` reads membership from a captured `Snapshot` without contacting tmux. |
| Erlang | [`tmux_snapshot:sessions/1`](/en/erlang/latest/reference/tmux_snapshot-sessions-1/) (function). Return captured sessions in numeric ID order. Performs no I/O and raises incomplete_snapshot when that collection was not captured. | free function. Returns captured rows without tmux I/O. |
| Common Lisp | [`libtmux:sessions`](/en/lisp/latest/reference/libtmux-sessions/) (function). Return a fresh vector of physical sessions in captured wire order. No I/O. | free function. 2 overloads. `sessions` returns a fresh vector from a captured snapshot without contacting tmux. |
| TypeScript | [`server.Server.sessions`](/en/ts/latest/reference/server-server-sessions/) (method). Every session on the server, read now. | async. on Server |
| Rust | [`server.Server.sessions`](/en/rs/latest/reference/server-server-sessions/) (method). List every session on the server, preserving any failure. | async. on Server |
| Go | [`tmux.Server.Sessions`](/en/go/latest/reference/tmux-server-sessions/) (method). Sessions materializes the server's sessions. Failures, including ErrNoServer, remain errors rather than empty results. | on Server |
| Java | [`io.github.libtmux.Server.sessions`](/en/java/latest/reference/io-github-libtmux-server-server-sessions/) (method). The sessions this expression matches, captured now. | on Server. 2 overloads |
| Clojure | [`libtmux.core/sessions!`](/en/clojure/latest/reference/libtmux-core-sessions/) (function). Acquires captured sessions; acquisition failure throws. | free function. Acquires a new captured graph and returns its session maps; acquisition failure throws. |
| Kotlin | [`io.github.libtmux.kotlin.Server.sessions`](/en/kotlin/latest/reference/io-github-libtmux-kotlin-server-sessions/) (method). Every session, captured now. | async. on Server. 2 overloads |
| Scala | [`io.github.libtmux.scaladsl.Server.sessions`](/en/scala/latest/reference/io-github-libtmux-scaladsl-server-sessions/) (method). The sessions this expression matches, captured now. | on Server. 2 overloads |
| C# | [`LibTmux.Server.Sessions`](/en/csharp/latest/reference/libtmux-server-sessions/) (property). Gets the sessions this handle captured. | None recorded in the model |
| F# | [`LibTmux.FSharp.Server.sessions`](/en/fsharp/latest/reference/libtmux-fsharp-server-sessions/) (function). Queries every session. | free function. Builds a deferred session query on `LibTmux.Server`. `Query.list` acquires the results; it does not traverse the handle’s captured membership. |
| C++ | [`libtmux::Server::sessions`](/en/cxx/latest/reference/libtmux-server-sessions/) (method). One snapshot each. | on Server. readonly |
| Swift | [`Server.sessions()`](/en/swift/latest/reference/server-sessions()/) (method). Every session on this server, in tmux's own order. | async. on Server |
| OCaml | [`Libtmux.Snapshot.sessions`](/en/ocaml/latest/reference/libtmux-snapshot-sessions/) (function) | free function. Reads an immutable array of already captured sessions without I/O. |
| Perl | [`LibTmux::Snapshot::sessions`](/en/perl/latest/reference/libtmux-snapshot-sessions/) (method). Return a fresh LibTmux::SessionSelection in captured order. Empty loaded collections yield empty selections; unloaded collections throw. | Reads captured membership locally, preserving order. |
| Raku | [`LibTmux::Model::Snapshot.sessions`](/en/raku/latest/reference/libtmux-model-snapshot-sessions/) (method). Captured sessions in acquisition order; reading performs no I/O. | None recorded in the model |

No Haskell equivalent. No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
