Name
chown — stdin stdout - file -- opt --help --version
Synopsis
chown [options
]user_spec files
The chown
(change owner)
command sets the ownership of files and directories. To make user
smith
the owner of several files
and a directory, run:
➜ sudo chown smith myfile myfile2 mydir
The user_spec
parameter may be any of
these possibilities:
A username (or numeric user ID), to set the owner:
chown smith myfile
A username (or numeric user ID), optionally followed by a colon and a group name (or numeric group ID), to set the owner and group:
chown smith:users myfile
A username (or numeric user ID) followed by a colon, to set the owner and to set the group to the invoking user’s login group:
chown smith: myfile
A group name (or numeric group ID) preceded by a colon, to set the group only:
chown :users myfile
. This is equivalent tochgrp users myfile
; see Group Management.
Useful options
| If the file is a symbolic link, change the link itself, not the file it points to. |
| Recursively change the ownership within a directory hierarchy. |
Get Macintosh Terminal Pocket Guide 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.