POSIX 1003.2B/D9 symbolic links
[unix-history] / usr / src / usr.bin / chflags / chflags.1
.\" Copyright (c) 1989, 1990, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the Institute of Electrical and Electronics Engineers, Inc.
.\"
.\" %sccs.include.redist.roff%
.\"
.\" @(#)chflags.1 8.2 (Berkeley) %G%
.\"
.Dd
.Dt CHFLAGS 1
.Os
.Sh NAME
.Nm chflags
.Nd change file flags
.Sh SYNOPSIS
.Nm chflags
.Oo
.Fl R
.Op Fl H | Fl L | Fl P
.Oc
.Ar flags
.Ar file ...
.Sh DESCRIPTION
The
.Nm chflags
utility modifies the file flags of the listed files
as specified by the
.Ar flags
operand.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl H
If the
.Fl R
option is specified, symbolic links on the command line are followed.
(Symbolic links encountered in the tree traversal are not followed.)
.It Fl L
If the
.Fl R
option is specified, all symbolic links are followed.
.It Fl P
If the
.Fl R
option is specified, no symbolic links are followed.
.It Fl R
Change the file flags for the file hierarchies rooted
in the files instead of just the files themselves.
.El
.Pp
Flags are a comma separated list of keywords.
The following keywords are currently defined:
.Bd -literal -offset indent compact
.\"arch nothing yet.
dump set the dump flag
sappnd set the system append-only flag (super-user only)
schg set the system immutable flag (super-user only)
uappnd set the user append-only flag (owner or super-user only)
uchg set the user immutable flag (owner or super-user only)
.Ed
.Pp
Putting the letters
.Dq no
before an option causes the flag to be turned off.
For example:
.Bd -literal -offset indent compact
nodump the file should never be dumped
.Ed
.Pp
Symbolic links do not have flags, so unless the
.Fl H
or
.Fl L
option is set,
.Nm chflags
on a symbolic link always succeeds and has no effect.
The
.Fl H ,
.Fl L
and
.Fl P
options are ignored unless the
.Fl R
option is specified.
In addition, these options override each other and the
command's actions are determined by the last one specified.
.Pp
The
.Nm chflags
utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr chflags 2 ,
.Xr stat 2 ,
.Xr fts 3 ,
.Xr symlink 7