LinuxCommandLibrary

pactree

Display package dependency tree

TLDR

Print the dependency tree of a specific package

$ pactree [package]
copy

Print what packages depend on a specific package
$ pactree [[-r|--reverse]] [package]
copy

Dump dependencies one per line, skipping duplicates
$ pactree [[-u|--unique]] [package]
copy

Include optional dependencies of a specific package and colorize the output
$ pactree [[-co|--color --optional]] [package]
copy

Display help
$ pactree
copy

SYNOPSIS

pactree [options] <package(s)>

PARAMETERS

-c, --color
    Colorizes the output for better readability.

-d, --depth <N>
    Limits the depth of the dependency tree displayed to N levels.

-f, --files
    Displays the files owned by the packages in the tree.

-g, --groups
    Displays package groups that packages belong to.

-h, --help
    Shows the help message and exits.

-i, --installed
    Displays only installed packages. This option implies --local.

-l, --local
    Queries the local package database. This is the default if no database selection options are given.

-r, --reverse
    Shows reverse dependencies, i.e., which packages depend on the specified package.

-s, --sync
    Queries the sync (remote) package database. This is the default if --local or --installed are not given.

-u, --unrequired
    Shows packages that are not explicitly required by any other installed package. Useful for identifying 'orphan' packages.

-v, --verbose
    Increases verbosity of the output.

-q, --quiet
    Suppresses warnings and errors during execution.

DESCRIPTION

pactree is a utility from the pacman-contrib package on Arch Linux. It's designed to visualize the dependency relationships between packages. It can show both direct dependencies (what a package needs to function) and reverse dependencies (which packages depend on a specified package). This command is invaluable for understanding the intricate web of package interconnections, aiding in system maintenance, troubleshooting, and identifying potentially orphaned packages. It provides a clear, tree-like representation, making complex dependency chains easy to follow.

CAVEATS

pactree is specific to Arch Linux and systems using the pacman package manager. It is part of the pacman-contrib package and is not natively available on other Linux distributions like Debian, Ubuntu, or Fedora unless compiled from source.

USAGE EXAMPLES

To show the dependency tree for a package like firefox:
pactree firefox

To show which packages depend on pacman (reverse dependencies):
pactree -r pacman

To limit the dependency depth to 2 levels for coreutils:
pactree -d 2 coreutils

To list packages that are not required by any other installed package:
pactree -u

HISTORY

pactree is a utility within the pacman-contrib package, a collection of helper scripts and tools for pacman, Arch Linux's official package manager. Its development is closely tied to the evolution of pacman and the Arch Linux ecosystem, continuously adapting to provide more insightful dependency analysis capabilities for users.

SEE ALSO

pacman(8), ldd(1)

Copied to clipboard