More commands

chown - change ownership

To change ownership of a file or directory, use the command chown.

chown [OPTIONS] USER[:GROUP] FILE(s)

Examples

  • chown USERNAME FILE the user with USERNAME becomes the new owner of FILE
  • chown USERNAME DIRECTORY the user with USERNAME becomes the new owner of DIRECTORY (but not any subdirectories)
  • chown USERNAME:folk DIRECTORY the user ownership is changed to USER and the group ownership to group “folk” for the directory DIRECTORY
  • chown :folk DIRECTORY the group ownership is changed to the group “folk” for the directory DIRECTORY
  • chown -R USERNAME:folk DIRECTORY the user ownership is changed to USERNAME and the group ownership is changed to group “folk” for the directory DIRECTORY and all subdirectories

Warning

As default, chown does not generate output on success and returns zero.