Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux chown command

Change file ownership. Use elevated privileges only when needed.

GNU Coreutils

Syntax

Command form
chown [OPTION]... [OWNER][:[GROUP]] FILE...

Common options

7 options
OptionWhat it does
OWNERSet the file owner; a user name or numeric ID may be used.
OWNER:GROUPSet owner and group together.
-R, --recursiveChange ownership recursively.
-h, --no-dereferenceAffect symbolic links rather than their targets (where supported).
-c, --changesReport only files whose ownership changed.
-v, --verboseReport every processed file.
--reference=RFILECopy owner and group from RFILE.

Usage examples

3 examples

Change file ownership. Use elevated privileges only when needed.

sudo chown user:group ./file

Set the owner and group of one file.

sudo chown alice:developers ./report.txt

Change ownership of a directory tree (review the path carefully).

sudo chown -R alice:developers ./project

Notes

Changing ownership usually needs administrator privileges. A recursive change can affect many files; verify the exact path before using -R.