dpkg-realpath(1) dpkg suite dpkg-realpath(1)

# [NAME](#NAME)

dpkg-realpath - print the resolved pathname with DPKG\_ROOT support

# [SYNOPSIS](#SYNOPSIS)

**dpkg-realpath** \[*option*...] *pathname*

# [DESCRIPTION](#DESCRIPTION)

**dpkg-realpath** is a tool to resolve a pathname, that takes the [**dpkg**(1)](/man/os/dpkg/dpkg.1) root directory into account, either implicitly from the **DPKG\_ROOT** environment variable or from the command-line **--root** or **--instdir** options, and returns an absolute *pathname* relative to the root directory. The root directory must not be prefixed to the *pathname* to be resolved.

This is intended to be used by other **dpkg** helpers, or by maintainer scripts instead of using [**realpath**(1)](/man/os/dpkg/realpath.1) or [**readlink**(1)](/man/os/dpkg/readlink.1) to canonicalize pathnames, as these latter commands do not support canonicalization relative to a different root than */*.

This program was introduced in dpkg 1.20.1.

# [OPTIONS](#OPTIONS)

[**-z**, **--zero**](#z)

Use a NUL byte to end output lines instead of a new line character.

Supported since dpkg 1.20.6.

[**--instdir** *directory*](#instdir)

[**--root** *directory*](#root)

Set the root directory to *directory*, which is the base directory that pathnames get canonicalized against. Defaults to «**/**» if **DPKG\_ROOT** has not been set.

**-?**, **--help**

Show the usage message and exit.

[**--version**](#version)

Show the version and exit.

# [ENVIRONMENT](#ENVIRONMENT)

[**DPKG\_ROOT**](#DPKG_ROOT)

If set and the **--instdir** or **--root** options have not been specified, it will be used as the filesystem root directory.

[**DPKG\_COLORS**](#DPKG_COLORS)

Sets the color mode. The currently accepted values are: **auto** (default), **always** and **never**.

[**DPKG\_NLS**](#DPKG_NLS)

If set, it will be used to decide whether to activate Native Language Support, also known as internationalization (or i18n) support. The accepted values are: **0** and **1** (default).

Supported since dpkg 1.22.7.

# [SEE ALSO](#SEE_ALSO)

[**realpath**(1)](/man/os/dpkg/realpath.1), [**readlink**(1)](/man/os/dpkg/readlink.1).

2026-09-09 1.23.11-dirty

---

Document: dpkg-realpath(1) from dpkg 1.23.11-r0 (Chainguard OS)
Source: https://git.dpkg.org/git/dpkg/dpkg.git
