Skip to content

chown

10 commands

Changes the owner and group of files and directories.

  • permissions
  • ownership

Install chown

sudo apt install coreutils

Basics10

chown <user> <file>

Changes the owner.

Link
chown <user>:<group> <file>

Changes owner and group together.

Link
chown :<group> <file>

Changes only the group (same as chgrp).

Link
chown <user>: <file>

Sets the owner and the owner’s login group.

Link
chown -R <user>:<group> <dir>

Changes ownership recursively.

Link
chown -v <user> <file>

Prints every change.

chown -h <user> <link>

Changes the symbolic link itself rather than its target.

Link
chown --reference=<ref> <file>

Copies ownership from another file (GNU).

Link
chown <uid>:<gid> <file>

Numeric IDs, useful in containers where names do not match.

Link
chgrp <group> <file>

Changes only the group.

Link