xref: /netbsd-src/usr.bin/stat/readlink.1 (revision 33b95c7f554eefca7831814a5bacbe8b11e83876)
1*33b95c7fSwiz.\"	$NetBSD: readlink.1,v 1.6 2022/07/21 10:08:28 wiz Exp $
214ef4b89Skre.\"
314ef4b89Skre.\" Copyright (c) 2002-2011 The NetBSD Foundation, Inc.
414ef4b89Skre.\" All rights reserved.
514ef4b89Skre.\"
614ef4b89Skre.\" This code is derived from software contributed to The NetBSD Foundation
714ef4b89Skre.\" by Andrew Brown and Jan Schaumann.
814ef4b89Skre.\"
914ef4b89Skre.\" Redistribution and use in source and binary forms, with or without
1014ef4b89Skre.\" modification, are permitted provided that the following conditions
1114ef4b89Skre.\" are met:
1214ef4b89Skre.\" 1. Redistributions of source code must retain the above copyright
1314ef4b89Skre.\"    notice, this list of conditions and the following disclaimer.
1414ef4b89Skre.\" 2. Redistributions in binary form must reproduce the above copyright
1514ef4b89Skre.\"    notice, this list of conditions and the following disclaimer in the
1614ef4b89Skre.\"    documentation and/or other materials provided with the distribution.
1714ef4b89Skre.\"
1814ef4b89Skre.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1914ef4b89Skre.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2014ef4b89Skre.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2114ef4b89Skre.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2214ef4b89Skre.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2314ef4b89Skre.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2414ef4b89Skre.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2514ef4b89Skre.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2614ef4b89Skre.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2714ef4b89Skre.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2814ef4b89Skre.\" POSSIBILITY OF SUCH DAMAGE.
2914ef4b89Skre.\"
3014ef4b89Skre.Dd June 22, 2022
3114ef4b89Skre.Dt READLINK 1
3214ef4b89Skre.Os
3314ef4b89Skre.Sh NAME
3414ef4b89Skre.Nm readlink
3514ef4b89Skre.Nd display target of a symbolic link
3614ef4b89Skre.Sh SYNOPSIS
3714ef4b89Skre.Nm
3814ef4b89Skre.Op Fl fnqsv
3914ef4b89Skre.Op Ar
4014ef4b89Skre.Sh DESCRIPTION
4114ef4b89SkreThe
4214ef4b89Skre.Nm
4314ef4b89Skreutility displays the target of a symbolic link.
4414ef4b89SkreIf a given argument
4514ef4b89Skre.Ar file
4614ef4b89Skreis not a symbolic link and the
4714ef4b89Skre.Fl f
4814ef4b89Skreoption is not specified,
4914ef4b89Skre.Nm readlink
5014ef4b89Skrewill print nothing to standard output about that
5114ef4b89Skre.Ar file
5214ef4b89Skreand eventually exit with an error status.
5314ef4b89SkreIf the
5414ef4b89Skre.Fl f
5514ef4b89Skreoption is specified, the output is canonicalized by following every symlink
5614ef4b89Skrein every component of the given path recursively.
5714ef4b89Skre.Nm
5814ef4b89Skrewill resolve both absolute and relative paths, and, if possible,
5914ef4b89Skrereturn the absolute pathname corresponding to
6014ef4b89Skre.Ar file .
6114ef4b89SkreIn this case, the argument does not need to be a symbolic link.
6214ef4b89Skre.Pp
6314ef4b89SkreThe options are as follows:
64b9ad2567Suwe.Bl -tag -width Fl
6514ef4b89Skre.It Fl f
6614ef4b89SkreCanonicalize the pathname of
6714ef4b89Skre.Ar file ,
6814ef4b89Skreas described above.
6914ef4b89Skre.It Fl n
7014ef4b89SkreDo not force a newline to appear after the output for each
7114ef4b89Skre.Ar file .
7214ef4b89Skre.It Fl q
7314ef4b89SkreSuppress failure messages if calls to
7414ef4b89Skre.Xr lstat 2
7514ef4b89Skrefail.
7614ef4b89SkreThis is the default for
7714ef4b89Skre.Nm readlink .
7814ef4b89Skre.It Fl s
7914ef4b89SkreThis is an alternative to
8014ef4b89Skre.Fl q .
8114ef4b89Skre.It Fl v
8214ef4b89SkreTurn off quiet mode.
8314ef4b89Skre.Nm
8414ef4b89Skrewill display errors about
85e4c7d7d3Suwe.Ar file\^ Ns s
8614ef4b89Skrefor which
8714ef4b89Skre.Xr lstat 2
8814ef4b89Skrefails.
8914ef4b89SkreThis is the inverse of
9014ef4b89Skre.Fl q
9114ef4b89Skreand
9214ef4b89Skre.Fl s .
93b9ad2567Suwe.El
9414ef4b89Skre.Sh SEE ALSO
95a71e9960Skre.Xr realpath 1 ,
96*33b95c7fSwiz.Xr stat 1 ,
9714ef4b89Skre.Xr lstat 2 ,
98540a4f05Swiz.Xr readlink 2
9914ef4b89Skre.Sh HISTORY
10014ef4b89SkreThe
10114ef4b89Skre.Nm
10214ef4b89Skreutility appeared along with
10314ef4b89Skre.Nm stat ,
10414ef4b89Skrewithin which it is integrated, in
10514ef4b89Skre.Nx 1.6 .
10614ef4b89Skre.Sh AUTHORS
10714ef4b89Skre.An -nosplit
10814ef4b89SkreThe
10914ef4b89Skre.Nm stat
11014ef4b89Skreutility was written by
11114ef4b89Skre.An Andrew Brown
11214ef4b89Skre.Aq atatat@NetBSD.org .
11314ef4b89SkreThe original combined man page was written by
11414ef4b89Skre.An Jan Schaumann
11514ef4b89Skre.Aq jschauma@NetBSD.org .
116