xref: /freebsd/bin/chflags/chflags.1 (revision a316b26e50bbed7cf655fbba726ab87d8ab7599d)
1.\" Copyright (c) 1989, 1990, 1993, 1994
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed by the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"	@(#)chflags.1	8.2 (Berkeley) 3/31/94
36.\"
37.Dd March 31, 1994
38.Dt CHFLAGS 1
39.Os
40.Sh NAME
41.Nm chflags
42.Nd change file flags
43.Sh SYNOPSIS
44.Nm chflags
45.Oo
46.Fl R
47.Op Fl H | Fl L | Fl P
48.Oc
49.Ar flags
50.Ar file ...
51.Sh DESCRIPTION
52The
53.Nm chflags
54utility modifies the file flags of the listed files
55as specified by the
56.Ar flags
57operand.
58.Pp
59The options are as follows:
60.Bl -tag -width Ds
61.It Fl H
62If the
63.Fl R
64option is specified, symbolic links on the command line are followed.
65(Symbolic links encountered in the tree traversal are not followed.)
66.It Fl L
67If the
68.Fl R
69option is specified, all symbolic links are followed.
70.It Fl P
71If the
72.Fl R
73option is specified, no symbolic links are followed.
74.It Fl R
75Change the file flags for the file hierarchies rooted
76in the files instead of just the files themselves.
77.El
78.Pp
79Flags are a comma separated list of keywords.
80The following keywords are currently defined:
81.Bd -literal -offset indent compact
82arch	set the archived flag (super-user only)
83dump	set the dump flag
84sappnd	set the system append-only flag (super-user only)
85schg	set the system immutable flag (super-user only)
86uappnd	set the user append-only flag (owner or super-user only)
87uchg	set the user immutable flag (owner or super-user only)
88archived, sappend, schange, simmutable, uappend, uchange, uimmutable
89	aliases for the above
90.Ed
91.Pp
92Putting the letters
93.Dq no
94before an option causes the flag to be turned off.
95For example:
96.Bd -literal -offset indent compact
97nodump	the file should never be dumped
98.Ed
99.Pp
100Symbolic links do not have flags, so unless the
101.Fl H
102or
103.Fl L
104option is set,
105.Nm chflags
106on a symbolic link always succeeds and has no effect.
107The
108.Fl H ,
109.Fl L
110and
111.Fl P
112options are ignored unless the
113.Fl R
114option is specified.
115In addition, these options override each other and the
116command's actions are determined by the last one specified.
117.Pp
118The
119.Nm chflags
120utility exits 0 on success, and >0 if an error occurs.
121.Sh SEE ALSO
122.Xr chflags 2 ,
123.Xr stat 2 ,
124.Xr fts 3 ,
125.Xr symlink 7
126