---
name: "readlink"
section: "1"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["linux", "freebsd", "openbsd", "macos"]
url: "https://new.carta.tech/readlink"
---

# readlink(1)

display target of symbolic link on standard output

## NAME

**readlink** – display target of symbolic link on standard output

## SYNOPSIS

**readlink** \[**-fn**\] *file*

## DESCRIPTION

The **readlink** utility when invoked with the pathname of a symbolic link as its argument dereferences the symbolic link and prints the name of target on standard output. If the **-f** option is not specified and **readlink** is invoked with an argument other than the pathname of a symbolic link, it exits with a nonzero exit code without printing anything.

The options are as follows:

- **-f**

  Canonicalize by following every symlink in every component of the given path recursively. **readlink** will resolve both absolute and relative paths and return the absolute pathname corresponding to *file*. The argument does not need to be a symbolic link.

- **-n**

  Do not print a trailing newline character.

## EXIT STATUS

The **readlink** utility exits 0 on success, and \>0 if an error occurs.

## SEE ALSO

[realpath(1)](/realpath/1.md), [readlink(2)](/readlink/2.md), [realpath(3)](/realpath/3.md)

## HISTORY

The **readlink** utility first appeared in OpenBSD 2.1.
