# Capture a workspace

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

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

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/csharp/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/csharp/latest/workspace/guides/export-session/) for the complete workflow.

[CLI source](https://github.com/libtmux/libtmux-dotnet/blob/f77fe776ba67a04abb20ddbbc26cf4a000d63b74/src/LibTmux.Workspace.Cli/README.md).
