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.\" 3. All advertising materials mentioning features or use of this software 17.\" must display the following acknowledgement: 18.\" This product includes software developed by the University of 19.\" California, Berkeley and its contributors. 20.\" 4. Neither the name of the University nor the names of its contributors 21.\" may be used to endorse or promote products derived from this software 22.\" without specific prior written permission. 23.\" 24.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34.\" SUCH DAMAGE. 35.\" 36.\" @(#)chflags.1 8.4 (Berkeley) 5/2/95 37.\" $FreeBSD: src/bin/chflags/chflags.1,v 1.30 2008/03/09 12:10:24 rwatson Exp $ 38.\" $DragonFly: src/usr.bin/chflags/chflags.1,v 1.8 2008/11/12 15:18:26 swildner Exp $ 39.\" 40.Dd November 11, 2008 41.Dt CHFLAGS 1 42.Os 43.Sh NAME 44.Nm chflags 45.Nd change file flags 46.Sh SYNOPSIS 47.Nm 48.Op Fl fhv 49.Oo 50.Fl R 51.Op Fl H | Fl L | Fl P 52.Oc 53.Ar flags 54.Ar 55.Sh DESCRIPTION 56The 57.Nm 58utility modifies the file flags of the listed files 59as specified by the 60.Ar flags 61operand. 62.Pp 63The options are as follows: 64.Bl -tag -width indent 65.It Fl f 66Do not display a diagnostic message if 67.Nm 68could not modify the flags for 69.Va file , 70nor modify the exit status to reflect such failures. 71.It Fl H 72If the 73.Fl R 74option is specified, symbolic links on the command line are followed. 75(Symbolic links encountered in the tree traversal are not followed.) 76.It Fl h 77If the 78.Ar file 79is a symbolic link, 80change the file flags of the link itself rather than the file to which it points. 81.It Fl L 82If the 83.Fl R 84option is specified, all symbolic links are followed. 85.It Fl P 86If the 87.Fl R 88option is specified, no symbolic links are followed. 89This is the default. 90.It Fl R 91Change the file flags for the file hierarchies rooted 92in the files instead of just the files themselves. 93.It Fl v 94Cause 95.Nm 96to be verbose, showing filenames as the flags are modified. 97If the 98.Fl v 99option is specified more than once, the old and new flags of the file 100will also be printed, in octal notation. 101.El 102.Pp 103The flags are specified as an octal number or a comma separated list 104of keywords. 105The following keywords are currently defined: 106.Bl -tag -offset indent -width ".Cm nouhistory" 107.It Cm arch , archived 108set the archived flag (super-user only) 109.It Cm opaque 110set the opaque flag (owner or super-user only) 111.It Cm nodump 112set the nodump flag (owner or super-user only) 113.It Cm noshistory 114set the system nohistory flag (super-user only) 115.It Cm nouhistory , nohistory 116set the user nohistory flag (owner or super-user only) 117.It Cm sappnd , sappend 118set the system append-only flag (super-user only) 119.It Cm schg , schange , simmutable 120set the system immutable flag (super-user only) 121.It Cm sunlnk , sunlink 122set the system undeletable flag (super-user only) 123.It Cm uappnd , uappend 124set the user append-only flag (owner or super-user only) 125.It Cm uchg , uchange , uimmutable 126set the user immutable flag (owner or super-user only) 127.It Cm uunlnk , uunlink 128set the user undeletable flag (owner or super-user only) 129.El 130.Pp 131Putting the letters 132.Dq Cm no 133before or removing the letters 134.Dq Cm no 135from a keyword causes the flag to be cleared. 136For example: 137.Pp 138.Bl -tag -offset indent -width "nouchg" -compact 139.It Cm nouchg 140clear the user immutable flag (owner or super-user only) 141.It Cm dump 142clear the nodump flag (owner or super-user only) 143.El 144.Pp 145A few of the octal values include: 146.Bl -tag -offset indent -width ".Li 10" 147.It Li 0 148Clear all file flags. 149.It Li 1 150Translates to the 151.Cm nodump 152keyword. 153.It Li 2 154Translates to the 155.Cm uchg 156keyword. 157.It Li 3 158Translates to the 159.Cm uchg , nodump 160keywords. 161.It Li 4 162Translates to the 163.Cm uappnd 164keyword. 165.It Li 10 166Translates to the 167.Cm opaque 168keyword. 169.It Li 20 170translates to the 171.Cm uunlnk 172keyword. 173.El 174.Pp 175Other combinations of keywords may be placed by using 176the octets assigned; however, these are the most notable. 177.Pp 178Unless the 179.Fl H , 180.Fl L , 181or 182.Fl h 183options are given, 184.Nm 185on a symbolic link always succeeds and has no effect. 186The 187.Fl H , 188.Fl L 189and 190.Fl P 191options are ignored unless the 192.Fl R 193option is specified. 194In addition, these options override each other and the 195command's actions are determined by the last one specified. 196.Pp 197You can use "ls -lo" to see the flags of existing files. 198.Pp 199Note that the ability to change certain flags is dependent 200on the current kernel 201.Va securelevel 202setting. 203See 204.Xr security 7 205for more information on this setting. 206.Sh EXIT STATUS 207.Ex -std 208.Sh SEE ALSO 209.Xr ls 1 , 210.Xr chflags 2 , 211.Xr stat 2 , 212.Xr fts 3 , 213.Xr security 7 , 214.Xr symlink 7 215.Sh HISTORY 216The 217.Nm 218command first appeared in 219.Bx 4.4 . 220.Sh BUGS 221Only a limited number of utilities are 222.Nm 223aware. 224Some of these tools include 225.Xr ls 1 , 226.Xr cp 1 , 227.Xr find 1 , 228.Xr install 1 , 229.Xr dump 8 , 230and 231.Xr restore 8 . 232In particular a tool which is not currently 233.Nm 234aware is the 235.Xr pax 1 236utility. 237