Reference grant

Grant Command Line Reference

Grant helps you view licenses for container images, SBOM documents, and filesystems. Apply filters and views that can help you build a picture of licenses in your SBOM.

Usage:
  grant [command]

Available Commands:
  check       Check license compliance for one or more targets
  completion  Generate the autocompletion script for the specified shell
  config      Generate a comprehensive configuration file
  help        Help about any command
  list        List licenses found in one or more targets
  version     Show the version information for grant

Flags:
  -c, --config string        path to configuration file
  -h, --help                 help for grant
      --no-output            suppress terminal output when writing to file
  -o, --output string        output format (table, json) (default "table")
  -f, --output-file string   write JSON output to file (sets output format to json)
  -q, --quiet                suppress all non-essential output
  -v, --verbose              enable verbose output
      --version              version for grant

Use "grant [command] --help" for more information about a command.

grant check

Check evaluates license compliance for container images, SBOMs, filesystems, and files.

Targets can be:

  • Container images: alpine:latest, ubuntu:22.04

  • SBOM files: path/to/sbom.json, path/to/sbom.json

  • Directories: dir:./project, ./my-app

  • Archive files: project.tar.gz, source.zip

  • License files: LICENSE, COPYING

  • Stdin: - (reads SBOM from stdin)

Exit codes:

  • 0: All targets are compliant

  • 1: One or more targets are non-compliant or an error occurred.

Usage:
  grant check [TARGET...] [flags]

Flags:
      --disable-file-search   disable filesystem license file search
      --dry-run               run check without returning non-zero exit code on violations
  -h, --help                  help for check
      --summary               show only summary information
      --unlicensed            show only packages without licenses

grant config

Generate a complete YAML configuration file with all available Grant options.

This command outputs a comprehensive configuration file that includes:

  • License policy options (allow lists, ignore patterns)

  • Command-line options with defaults

  • Detailed comments explaining each option

The generated configuration can be saved to a file and customized as needed.

Usage:
  grant config [flags]

Flags:
  -h, --help            help for config
  -o, --output string   output file path (default: stdout)

grant list

List shows all licenses found in container images, SBOMs, filesystems, and files

without applying policy evaluation.

Targets can be:

  • Container images: alpine:latest, ubuntu:22.04

  • SBOM files: path/to/sbom.json, path/to/sbom.xml

  • Directories: dir:./project, ./my-app

  • Archive files: project.tar.gz, source.zip

  • License files: LICENSE, COPYING

  • Stdin: - (reads SBOM from stdin)

When no target is specified and stdin is available (piped input), grant will

automatically read from stdin. This allows usage like:

syft -o json dir:. | grant list Apache-2.0

License filtering:

If license names are provided as additional arguments, only packages with those

specific licenses will be shown. For example:

grant list dir:. “MIT” “Apache-2.0”

syft -o json dir:. | grant list “MIT” “Apache-2.0”

This command always returns exit code 0 unless there are processing errors.

Usage:
  grant list [TARGET] [LICENSE...] [flags]

Flags:
      --disable-file-search   disable filesystem license file search
      --group-by string       group results by specified field (risk)
  -h, --help                  help for list
      --pkg string            show detailed information for a specific package (requires license filter)
      --unlicensed            show only packages without licenses

grant version

Show the version information for grant.

Usage:
  grant version [flags]

Flags:
  -h, --help   help for version
Last modified November 26, 2025: allow local too invocation (d20d613)