Linux "chown" Command Line Options and Examples
change ownership of a file

This manual page documents the GNU version of chown. chown changes the user and/or group ownership of each given file. If only an owner (a user name or numeric user ID) is given, that user is made the owner of each given file, and the files' group is not changed.


Usage:

chown [OPTION]... [OWNER][:[GROUP]] FILE...
    chown [OPTION]... --reference=RFILE FILE...




Command Line Options:

-c
like verbose but report only when a change is made
chown -c ...
-f
suppress most error messages
chown -f ...
-v
output a diagnostic for every file processed
chown -v ...
--dereference
affect the referent of each symbolic link (this is the default), rather than the symbolic link itself
chown --dereference ...
-h
affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)
chown -h ...
--from
change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may beomitted, in which case a match is not required for the omitted attribute
chown --from ...
--no-preserve-root
do not treat '/' specially (the default)
chown --no-preserve-root ...
--preserve-root
fail to operate recursively on '/'
chown --preserve-root ...
--reference
use RFILE's owner and group rather than specifying OWNER:GROUP values
chown --reference ...
-R
operate on files and directories recursivelyThe following options modify how a hierarchy is traversed when the -R option is also specified. If more than one is specified, onlythe final one takes effect.
chown -R ...
-H
if a command line argument is a symbolic link to a directory, traverse it
chown -H ...
-L
traverse every symbolic link to a directory encountered
chown -L ...
-P
do not traverse any symbolic links (default)
chown -P ...
--help
display this help and exit
chown --help ...
--version
output version information and exitOwner is unchanged if missing. Group is unchanged if missing, but changed to login group if implied by a ':' following a symbolicOWNER. OWNER and GROUP may be numeric as well as symbolic.EXAMPLESchown root /uChange the owner of /u to "root".chown root:staff /uLikewise, but also change its group to "staff".chown -hR root /uChange the owner of /u and subfiles to "root".AUTHORWritten by David MacKenzie and Jim Meyering.REPORTING BUGSGNU coreutils online help: <http://www.gnu.org/software/coreutils/>Report chown translation bugs to <http://translationproject.org/team/>COPYRIGHTCopyright © 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
chown --version ...