Name
chflags
Synopsis
chflags [options] flagsfiles
Changes the file flags of one or more
files. flags is a
comma-separated list of file flags, described below. To unset a flag,
use the same command but with no added to the
front of the flag’s name. To view a
file’s current flags, use the ls
-lo command.
Options
- -
H If any of the pathnames given in the command line are symbolic links, follow only those links during recursive operation. Works only with the
-Roption.-
-L Follow all symbolic links during recursive operation. Works only with the
-Roption.-
-P Follow no symbolic links during recursive operation. Works only with the
-Roption (the default).-
-R Recursively descend through the directory, including subdirectories and symbolic links, changing the specified file flags as it proceeds.
Flags
|
Flag name |
Flag set |
Who can change |
|---|---|---|
|
|
archived |
Superuser only |
|
|
opaque |
Owner or superuser only |
|
|
nodump |
Owner or superuser only |
|
|
system append-only |
Superuser only |
|
|
system immutable |
Superuser only |
|
|
user append-only |
Owner or superuser only |
|
|
user immutable |
Owner or superuser only |
Though the system append-only (sappend) and system
immutable (schg) flags can be set by the superuser
in normal system mode, you can only unset them
while in single-user mode.
Examples
Setting the user immutable (uchg) flag for a file prevents it from being deleted, changed, or moved. By locking a file in the Finder, you’re actually setting its user ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access