chflags -- change file flags

chflags [-fhv] [-R [-H | -L | -P]] flags file

Modifies the file flags of the listed files as specified by the flags operand.

-f force, forge-ahead, i.e do not display a diagnostic message if chflags could not modify the flags for file, nor modify the exit status to reflect such failures.
-v verbose, showing filenames as the flags are modified. Specify more than once, to output the old and new flags of the file, in octal notation.
-h If the file is a symbolic link, change the file flags of the link itself rather than the file to which it points.
-R recurse, Change the file flags for the file hierarchies rooted in the files instead of just the files themselves. the tree traversal are not followed.)
-H with -R, symbolic links on the command line are followed. (Symbolic links encountered in
-L with -R, all symbolic links are followed.
-P with -R, Prevent symbolic links from being followed. This is the default.

The flags to set the flags are specified as an octal number or a comma separated list of keywords.

arch
archived
002000000
archived (super-user only)
opaque
000000010
(owner or super-user only). [Directory is opaque when viewed through a union mount]
nodump
000000001
(owner or super-user only)
sappnd
sappend
010000000
system append-only (super-user only)
uappnd
uappend
000000004
user append-only (owner or super-user only)
schg
schange
simmutable
004000000
system immutable (super-user only)
uchg
uchange
uimmutable
000000002
user immutable (owner or super-user only)
Prevents even root from updating owner via chown
hidden
001000000
hidden [Hide item from GUI]


The sappnd and schg flags may only be unset when the system is in single-user mode. As discussed in chflags(2), as of Darwin Mountain Lion 11/5/12

Putting no before or removing the letters no from a keyword causes the flag to be cleared. For example:

nouchg clear the user immutable flag (owner or super-user only)
dump clear the nodump flag (owner or super-user only)

Unless -H or -L are given, chflags on a symbolic link always succeeds and has no effect.
The -H, -L and -P options are ignored unless the -R option is specified. In addition, these options override each other and the command's actions are determined by the last one specified.

Use ls -lO to see the flags .

EXIT STATUS

The chflags utility exits 0 on success, and >0 if an error occurs.

SEE ALSO

ls(1), chflags(2), stat(2), fts(3), symlink(7)

HISTORY

The chflags command first appeared in 4.4BSD.

BUGS

Only a limited number of utilities are chflags aware. Some of these tools include ls(1), cp(1), find(1), install(1), dump(8), and restore(8). In particular a tool which is not currently chflags aware is the pax(1) utility.