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 May 14, 2005 36.Dt CHFLAGS 1 37.Os 38.Sh NAME 39.Nm chflags 40.Nd change file flags 41.Sh SYNOPSIS 42.Nm 43.Op Fl h 44.Oo 45.Fl R 46.Op Fl H | Fl L | Fl P 47.Oc 48.Ar flags 49.Ar 50.Sh DESCRIPTION 51The 52.Nm 53utility modifies the file flags of the listed files 54as specified by the 55.Ar flags 56operand. 57.Pp 58The options are as follows: 59.Bl -tag -width indent 60.It Fl H 61If the 62.Fl R 63option is specified, symbolic links on the command line are followed. 64(Symbolic links encountered in the tree traversal are not followed.) 65.It Fl h 66If the 67.Ar file 68is a symbolic link, 69change the mode of the link itself rather than the file to which it points. 70.It Fl L 71If the 72.Fl R 73option is specified, all symbolic links are followed. 74.It Fl P 75If the 76.Fl R 77option is specified, no symbolic links are followed. 78This is the default. 79.It Fl R 80Change the file flags for the file hierarchies rooted 81in the files instead of just the files themselves. 82.El 83.Pp 84The flags are specified as an octal number or a comma separated list 85of keywords. 86The following keywords are currently defined: 87.Pp 88.Bl -tag -offset indent -width ".Ar opaque" 89.It Ar arch , archived 90set the archived flag (super-user only) 91.It Ar opaque 92set the opaque flag (owner or super-user only) 93.It Ar nodump 94set the nodump flag (owner or super-user only) 95.It Ar sappnd , sappend 96set the system append-only flag (super-user only) 97.It Ar schg , schange , simmutable 98set the system immutable flag (super-user only) 99.It Ar sunlnk , sunlink 100set the system undeletable flag (super-user only) 101.It Ar uappnd , uappend 102set the user append-only flag (owner or super-user only) 103.It Ar uchg , uchange , uimmutable 104set the user immutable flag (owner or super-user only) 105.It Ar uunlnk , uunlink 106set the user undeletable flag (owner or super-user only) 107.El 108.Pp 109Putting the letters 110.Dq Ar no 111before or removing the letters 112.Dq Ar no 113from a keyword causes the flag to be cleared. 114For example: 115.Pp 116.Bl -tag -offset indent -width "nouchg" -compact 117.It Ar nouchg 118clear the user immutable flag (owner or super-user only) 119.It Ar dump 120clear the nodump flag (owner or super-user only) 121.El 122.Pp 123Unless the 124.Fl H , 125.Fl L , 126or 127.Fl h 128options are given, 129.Nm 130on a symbolic link always succeeds and has no effect. 131The 132.Fl H , 133.Fl L 134and 135.Fl P 136options are ignored unless the 137.Fl R 138option is specified. 139In addition, these options override each other and the 140command's actions are determined by the last one specified. 141.Pp 142You can use "ls -lo" to see the flags of existing files. 143.Sh EXIT STATUS 144.Ex -std 145.Sh SEE ALSO 146.Xr ls 1 , 147.Xr chflags 2 , 148.Xr stat 2 , 149.Xr fts 3 , 150.Xr symlink 7 151.Sh BUGS 152Only a limited number of utilities are 153.Nm 154aware. 155Some of these tools include 156.Xr ls 1 , 157.Xr cp 1 , 158.Xr find 1 , 159.Xr install 1 , 160.Xr dump 8 , 161and 162.Xr restore 8 . 163In particular a tool which is not currently 164.Nm 165aware is the 166.Xr pax 1 167utility. 168.Sh HISTORY 169The 170.Nm 171command first appeared in 172.Bx 4.4 . 173