xref: /freebsd/bin/chflags/chflags.1 (revision ca9ac06c99bfd0150b85d4d83c396ce6237c0e05)
1.\"-
2.\" Copyright (c) 1989, 1990, 1993, 1994
3.\"	The Regents of the University of California.  All rights reserved.
4.\"
5.\" This code is derived from software contributed to Berkeley by
6.\" the Institute of Electrical and Electronics Engineers, Inc.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"	@(#)chflags.1	8.4 (Berkeley) 5/2/95
33.\" $FreeBSD$
34.\"
35.Dd February 24, 2005
36.Dt CHFLAGS 1
37.Os
38.Sh NAME
39.Nm chflags
40.Nd change file flags
41.Sh SYNOPSIS
42.Nm
43.Oo
44.Fl R
45.Op Fl H | Fl L | Fl P
46.Oc
47.Ar flags
48.Ar
49.Sh DESCRIPTION
50The
51.Nm
52utility modifies the file flags of the listed files
53as specified by the
54.Ar flags
55operand.
56.Pp
57The options are as follows:
58.Bl -tag -width indent
59.It Fl H
60If the
61.Fl R
62option is specified, symbolic links on the command line are followed.
63(Symbolic links encountered in the tree traversal are not followed.)
64.It Fl L
65If the
66.Fl R
67option is specified, all symbolic links are followed.
68.It Fl P
69If the
70.Fl R
71option is specified, no symbolic links are followed.
72This is the default.
73.It Fl R
74Change the file flags for the file hierarchies rooted
75in the files instead of just the files themselves.
76.El
77.Pp
78The flags are specified as an octal number or a comma separated list
79of keywords.
80The following keywords are currently defined:
81.Pp
82.Bl -tag -offset indent -width ".Ar opaque"
83.It Ar arch , archived
84set the archived flag (super-user only)
85.It Ar opaque
86set the opaque flag (owner or super-user only)
87.It Ar nodump
88set the nodump flag (owner or super-user only)
89.It Ar sappnd , sappend
90set the system append-only flag (super-user only)
91.It Ar schg , schange , simmutable
92set the system immutable flag (super-user only)
93.It Ar sunlnk , sunlink
94set the system undeletable flag (super-user only)
95.It Ar uappnd , uappend
96set the user append-only flag (owner or super-user only)
97.It Ar uchg , uchange , uimmutable
98set the user immutable flag (owner or super-user only)
99.It Ar uunlnk , uunlink
100set the user undeletable flag (owner or super-user only)
101.El
102.Pp
103Putting the letters
104.Dq Ar no
105before or removing the letters
106.Dq Ar no
107from a keyword causes the flag to be cleared.
108For example:
109.Pp
110.Bl -tag -offset indent -width "nouchg" -compact
111.It Ar nouchg
112clear the user immutable flag (owner or super-user only)
113.It Ar dump
114clear the nodump flag (owner or super-user only)
115.El
116.Pp
117Symbolic links do not have flags, so unless the
118.Fl H
119or
120.Fl L
121option is set,
122.Nm
123on a symbolic link always succeeds and has no effect.
124The
125.Fl H ,
126.Fl L
127and
128.Fl P
129options are ignored unless the
130.Fl R
131option is specified.
132In addition, these options override each other and the
133command's actions are determined by the last one specified.
134.Pp
135You can use "ls -lo" to see the flags of existing files.
136.Sh EXIT STATUS
137.Ex -std
138.Sh SEE ALSO
139.Xr ls 1 ,
140.Xr chflags 2 ,
141.Xr stat 2 ,
142.Xr fts 3 ,
143.Xr symlink 7
144.Sh BUGS
145Only a limited number of utilities are
146.Nm
147aware.
148Some of these tools include
149.Xr ls 1 ,
150.Xr cp 1 ,
151.Xr find 1 ,
152.Xr install 1 ,
153.Xr dump 8 ,
154and
155.Xr restore 8 .
156In particular a tool which is not currently
157.Nm
158aware is the
159.Xr pax 1
160utility.
161.Sh HISTORY
162The
163.Nm
164command first appeared in
165.Bx 4.4 .
166