# Export an SBOM of a server
Source: https://shld.app/guides/export-an-sbom · Updated 2026-11-25 · Synced from shld f6c77924

> Write a CycloneDX or SPDX package inventory, inspect incomplete scans, and hand the sensitive file to another scanner.


At the end, you will have the server's package inventory as CycloneDX or SPDX JSON, written to a file or to stdout.

The file holds the server's package inventory. Treat it as sensitive and keep it under administrator control.

## Before you start

- Use a Linux server with the shld binary installed. The export does not need the agent service.
- Use shld `v0.1.0-pilot.20261110.3` or later, the first release tag that contains `shld sbom`. Run `shld version` to check; older binaries do not have the command.
- Choose a private output path when you write a file.
- Install another scanner when you want a second review.

## Steps

1. Export the server inventory as CycloneDX 1.6 JSON.

```sh
shld sbom --root / --output inventory.json
```

The command writes `inventory.json` with mode `0600`. Each package entry includes its package URL, version, and manifest or install path within the selected root. Run `shld sbom` without `--output` to write the CycloneDX document to stdout instead. To export another directory, give its path to `shld sbom --root`.

2. Select an SPDX 2.3 JSON document when the receiving tool needs SPDX.

```sh
shld sbom --root / --format spdx --output inventory.spdx.json
```

3. Review stderr for packages without an expressible package URL. shld skips those packages and counts them in a warning.
4. Send the file to another scanner only after you review its contents.

```sh
grype sbom:inventory.json
```

The export needs no agent, state directory, or network. shld sends no inventory off the server.

## If something goes wrong

- Exit `0` means the scan completed and the export finished.
- Exit `1` means an invocation or input/output error stopped the export. Check the command and the output path, then run it again.
- Exit `2` means the inventory is incomplete. shld still writes the SBOM, and stderr names affected paths and reasons. Review those paths before you hand the file to another scanner.
- A package lacks an expressible package URL. shld skips that package and reports the count on stderr.
- The output path is a symlink. shld refuses the target. Choose a regular private path.

## Related

- [CLI reference](/docs/cli)
- [Update shld and roll back](/guides/update-shld)
- [shld and Grype](/compare/grype)
