xref: /netbsd-src/usr.bin/stat/readlink.1 (revision 33b95c7f554eefca7831814a5bacbe8b11e83876)
1.\"	$NetBSD: readlink.1,v 1.6 2022/07/21 10:08:28 wiz Exp $
2.\"
3.\" Copyright (c) 2002-2011 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Andrew Brown and Jan Schaumann.
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.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd June 22, 2022
31.Dt READLINK 1
32.Os
33.Sh NAME
34.Nm readlink
35.Nd display target of a symbolic link
36.Sh SYNOPSIS
37.Nm
38.Op Fl fnqsv
39.Op Ar
40.Sh DESCRIPTION
41The
42.Nm
43utility displays the target of a symbolic link.
44If a given argument
45.Ar file
46is not a symbolic link and the
47.Fl f
48option is not specified,
49.Nm readlink
50will print nothing to standard output about that
51.Ar file
52and eventually exit with an error status.
53If the
54.Fl f
55option is specified, the output is canonicalized by following every symlink
56in every component of the given path recursively.
57.Nm
58will resolve both absolute and relative paths, and, if possible,
59return the absolute pathname corresponding to
60.Ar file .
61In this case, the argument does not need to be a symbolic link.
62.Pp
63The options are as follows:
64.Bl -tag -width Fl
65.It Fl f
66Canonicalize the pathname of
67.Ar file ,
68as described above.
69.It Fl n
70Do not force a newline to appear after the output for each
71.Ar file .
72.It Fl q
73Suppress failure messages if calls to
74.Xr lstat 2
75fail.
76This is the default for
77.Nm readlink .
78.It Fl s
79This is an alternative to
80.Fl q .
81.It Fl v
82Turn off quiet mode.
83.Nm
84will display errors about
85.Ar file\^ Ns s
86for which
87.Xr lstat 2
88fails.
89This is the inverse of
90.Fl q
91and
92.Fl s .
93.El
94.Sh SEE ALSO
95.Xr realpath 1 ,
96.Xr stat 1 ,
97.Xr lstat 2 ,
98.Xr readlink 2
99.Sh HISTORY
100The
101.Nm
102utility appeared along with
103.Nm stat ,
104within which it is integrated, in
105.Nx 1.6 .
106.Sh AUTHORS
107.An -nosplit
108The
109.Nm stat
110utility was written by
111.An Andrew Brown
112.Aq atatat@NetBSD.org .
113The original combined man page was written by
114.An Jan Schaumann
115.Aq jschauma@NetBSD.org .
116