READLINK(1) | General Commands Manual | READLINK(1)

# NAME

`readlink` —
display target of a symbolic link

# SYNOPSIS

`readlink` | [`-fnqsv`] [file ...]

# DESCRIPTION

The `readlink` utility displays the target of a symbolic link. If a given argument file is not a symbolic link and the `-f` option is not specified, `readlink` will print nothing to standard output about that file and eventually exit with an error status. If the `-f` option is specified, the output is canonicalized by following every symlink in every component of the given path recursively. `readlink` will resolve both absolute and relative paths, and, if possible, return the absolute pathname corresponding to file. In this case, the argument does not need to be a symbolic link.

The options are as follows:

`-f`
  Canonicalize the pathname of file, as described above.
`-n`
  Do not force a newline to appear after the output for each file.
`-q`
  Suppress failure messages if calls to lstat(2) fail. This is the default for `readlink`.
`-s`
  This is an alternative to `-q`.
`-v`
  Turn off quiet mode. `readlink` will display errors about files for which lstat(2) fails. This is the inverse of `-q` and `-s`.

# SEE ALSO

realpath(1), stat(1), lstat(2), readlink(2)

# HISTORY

The `readlink` utility appeared along with `stat`, within which it is integrated, in NetBSD 1.6.

# AUTHORS

The `stat` utility was written by Andrew Brown ⟨atatat@NetBSD.org⟩. The original combined man page was written by Jan Schaumann ⟨jschauma@NetBSD.org⟩.

June 22, 2022 | NetBSD 10.1