---
schema_version: "1"
id: 2d3b1853aa4c8c089c6fed32eec9bda9c58be4287d00c17b8f6de4b476786a52
title: package version displayancestry
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/package/cli_reference_package_version_displayancestry.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_package_version_displayancestry.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: a8032d0361b65b14bb0eaf91144e0bee25342b7230f20ac5b66198b7802cf078
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# package version displayancestry

Display the ancestry tree for a 2GP managed package version.

## Aliases for package version displayancestry

`force:package:version:displayancestry`

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;api&#8209;version</code> | N/A | **Type:** Value<br><br>Override the api version used for api requests made by this command |
| <code>&#8209;&#8209;dot&#8209;code</code> | N/A | **Type:** Boolean<br><br>Display the ancestry tree in DOT code.<br><br>You can use the DOT code output in graph visualization software to create tree visualizations. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;package</code> | <code>&#8209;p</code> | **Type:** Value<br>**Required**<br><br>ID or alias of the package (starts with 0Ho) or package version (starts with 04t) to display ancestry for.<br><br>If you specify a package ID (starts with 0Ho) or alias, the ancestor tree for every package version associated with the package ID is displayed. If you specify a package version (starts with 04t) or alias, the ancestry tree of the specified package version is displayed. |
| <code>&#8209;&#8209;target&#8209;dev&#8209;hub</code> | <code>&#8209;v</code> | **Type:** Value<br>**Required**<br><br>Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. |
| <code>&#8209;&#8209;verbose</code> | N/A | **Type:** Boolean<br><br>Display both the package version ID (starts with 04t) and the version number (major.minor.patch.build) in the ancestry tree. |

## Examples for package version displayancestry

Display the ancestry tree for a package version with the specified alias, using your default Dev Hub org:

```shell
sf package version displayancestry --package package_version_alias
```

Similar to previous example, but display the output in DOT code:

```shell
sf package version displayancestry --package package_version_alias --dot-code
```

Display the ancestry tree for a package with the specified ID, using the Dev Hub org with username devhub@example.com:

```shell
sf package version displayancestry --package OHo... --target-dev-hub devhub@example.com
```

Display the ancestry tree of a package version with the specified ID, using your default Dev Hub org:

```shell
sf package version displayancestry --package 04t...
```
<!-- prettier-ignore-end -->
