# Capture a workspace

Source: https://libtmux.org/en/ts/latest/workspace/cli/freeze/

> Capture a running tmux session as a starting point for a workspace file.

**Workspace Manager concept example** A working example of the core library. It can change without notice.



Capture a running tmux session as a starting point for a workspace file. Capture
reads live state. It cannot recover original command arguments, command history,
script definitions or plugin intent.

## Inspect a session

After the [installation walkthrough](https://libtmux.org/en/ts/latest/workspace/guides/installation/) creates
`workspace-guide`, request a machine result from its private socket:

```console
$ tmux-workspace freeze \
    -S "$WORKSPACE_TMP/tmux.sock" \
    --json \
    workspace-guide
```

## Save the captured document

Name the destination and format explicitly:

```console
$ tmux-workspace freeze \
    -S "$WORKSPACE_TMP/tmux.sock" \
    --json \
    --workspace-format yaml \
    --save-to captured-workspace.yaml \
    workspace-guide
```

Use a new destination, or pass `--force` to authorize replacement. Review
captured commands and directories before loading the file on another machine.
The saved document encoding is separate from the CLI result format selected by
`--json` or `--ndjson`.

See [export and reload](https://libtmux.org/en/ts/latest/workspace/guides/export-session/) for the complete workflow.

[CLI source](https://github.com/libtmux/libtmux-ts/blob/f36d692552bb9a373b45338bb5fece854e57cc3d/packages/workspace-cli/README.md).
