Name

chown

Synopsis

    chown [options] newowner[:newgroup]files

Change the ownership of one or more files to newowner. newowner is either a user ID number or a login name located in /etc/passwd. The optional newgroup is either a group ID number (GID) or a group name located in the /etc/group file. When newgroup is supplied, the behavior is to change the ownership of one or more files to newowner and make it belong to newgroup.

Note: some systems accept a period as well as the colon for separating newowner and newgroup. The colon is mandated by POSIX; the period is accepted for compatibility with older BSD systems.

Common Options

-f, --quiet, --silent

Do not print error messages about files that cannot be changed.

-h, --no-dereference

Change the owner on symbolic links. Normally, chown acts on the file referenced by a symbolic link, not on the link itself.

-R, --recursive

Recursively descend through the directory, including subdirectories and symbolic links, setting the specified group ID as it proceeds. The last of -H, -L, and -P takes effect when used with -R.

GNU/Linux and Mac OS X Options

-H

When used with -R, if a command-line argument is a symbolic link to a directory, recursively traverse the directory. In other words, follow the link.

-L

When used with -R, if any symbolic link points to a directory, recursively traverse the directory.

-P

When used with -R, do not follow any symbolic links. This is the default.

-v, --verbose

Verbosely describe ownership changes.

GNU/Linux Options

-c, --changes ...

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.