O'Reilly logo

Mac OS X Tiger in a Nutshell by Jason McIntosh, Chuck Toporek, Chris Stone, Andy Lester

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

chflags

Synopsis

chflags [options] flags files

Changes the file flags of one or more files. flags is a comma-separated list of file flags, described later. 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 -R option.

-L

Follow all symbolic links during recursive operation. Works only with the -R option.

-P

Follow no symbolic links during recursive operation. Works only with the -R option (the default).

-R

Recursively descend through the directory, including subdirectories and symbolic links, changing the specified file flags as it proceeds.

Flags

Table 2-2. Flags used with the chflags command

Flag name

Flag set

Who can change it

arch

Archived

Superuser only

opaque

Opaque

Owner or superuser only

nodump

Nodump

Owner or superuser only

sappnd

System append-only

Superuser only

schg

System immutable

Superuser only

uappnd

User append-only

Owner or superuser only

uchg

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required