1.\" $OpenBSD: readlink.1,v 1.14 2021/10/13 15:04:53 kn Exp $ 2.\" 3.\" Copyright (c) 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" This code is derived from software contributed to Berkeley by 7.\" the Institute of Electrical and Electronics Engineers, Inc. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. Neither the name of the University nor the names of its contributors 18.\" may be used to endorse or promote products derived from this software 19.\" without specific prior written permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" SUCH DAMAGE. 32.\" 33.Dd $Mdocdate: October 13 2021 $ 34.Dt READLINK 1 35.Os 36.Sh NAME 37.Nm readlink 38.Nd display target of symbolic link on standard output 39.Sh SYNOPSIS 40.Nm readlink 41.Op Fl fn 42.Ar file 43.Sh DESCRIPTION 44The 45.Nm 46utility when invoked with the pathname of a symbolic link as its 47argument dereferences the symbolic link and prints the name of target 48on standard output. 49If the 50.Fl f 51option is not specified and 52.Nm 53is invoked with an argument other 54than the pathname of a symbolic link, it exits with a nonzero exit 55code without printing anything. 56.Pp 57The options are as follows: 58.Bl -tag -width Ds 59.It Fl f 60Canonicalize by following every symlink in every component of the given 61path recursively. 62.Nm 63will resolve both absolute and relative paths and 64return the absolute pathname corresponding to 65.Ar file . 66The argument does not need to be a symbolic link. 67.It Fl n 68Do not print a trailing newline character. 69.El 70.Sh EXIT STATUS 71.Ex -std readlink 72.Sh SEE ALSO 73.Xr realpath 1 , 74.Xr readlink 2 , 75.Xr realpath 3 76.Sh HISTORY 77The 78.Nm 79utility first appeared in 80.Ox 2.1 . 81