NetBSD/usr.bin/stat/readlink.1

116 lines
3.1 KiB
Groff

.\" $NetBSD: readlink.1,v 1.6 2022/07/21 10:08:28 wiz Exp $
.\"
.\" Copyright (c) 2002-2011 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Andrew Brown and Jan Schaumann.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd June 22, 2022
.Dt READLINK 1
.Os
.Sh NAME
.Nm readlink
.Nd display target of a symbolic link
.Sh SYNOPSIS
.Nm
.Op Fl fnqsv
.Op Ar
.Sh DESCRIPTION
The
.Nm
utility displays the target of a symbolic link.
If a given argument
.Ar file
is not a symbolic link and the
.Fl f
option is not specified,
.Nm readlink
will print nothing to standard output about that
.Ar file
and eventually exit with an error status.
If the
.Fl f
option is specified, the output is canonicalized by following every symlink
in every component of the given path recursively.
.Nm
will resolve both absolute and relative paths, and, if possible,
return the absolute pathname corresponding to
.Ar file .
In this case, the argument does not need to be a symbolic link.
.Pp
The options are as follows:
.Bl -tag -width Fl
.It Fl f
Canonicalize the pathname of
.Ar file ,
as described above.
.It Fl n
Do not force a newline to appear after the output for each
.Ar file .
.It Fl q
Suppress failure messages if calls to
.Xr lstat 2
fail.
This is the default for
.Nm readlink .
.It Fl s
This is an alternative to
.Fl q .
.It Fl v
Turn off quiet mode.
.Nm
will display errors about
.Ar file\^ Ns s
for which
.Xr lstat 2
fails.
This is the inverse of
.Fl q
and
.Fl s .
.El
.Sh SEE ALSO
.Xr realpath 1 ,
.Xr stat 1 ,
.Xr lstat 2 ,
.Xr readlink 2
.Sh HISTORY
The
.Nm
utility appeared along with
.Nm stat ,
within which it is integrated, in
.Nx 1.6 .
.Sh AUTHORS
.An -nosplit
The
.Nm stat
utility was written by
.An Andrew Brown
.Aq atatat@NetBSD.org .
The original combined man page was written by
.An Jan Schaumann
.Aq jschauma@NetBSD.org .