1. Change the owner of a file
# chown [owner_name] [file_name]
Example
# chown root temp.txt
2. Change the group of a file
# chown :[group_name] [file_name]
Example
# chown :root temp.txt
3. Change both owner and the group
# chown [owner_name]:[group_name] [file_name]
Example
# chown root:root temp.txt
4. Using chown command on symbolic link file
# chown [owner_name]:[group_name] [file_symbolic_link]
Example
# chown root:root temp_symlnk
with -h flag change will be enforced
# chown -h root:root temp_symlnk
with -R flag we can use chown against symbolic link directory
# chown -R -H root:root temp_symlnk
5. Change owner only if a file is owned by a particular user
# chown --from=[owner_name] [new_owner_name] [file_name]
Example
# chown --from=root jenkins temp.txt
6. Change group only if a file already belongs to a certain group
# chown --from=:[group_name] :[new_group_name] [file_name]
Example
# chown --from=:root :jenkins temp.txt
7. Copy the owner/group settings from one file to another
# chown --reference=[source_file] [destination_file]
Example
# chown --reference=settings.txt temp.txt
8. Change the owner/group of the files by traveling the directories recursively
# chown -R [user_name]:[group_name] [directory_name]/
Example
# chown -R jenkins:jenkins jenkins/
9. List all the changes made by the chown command
# chown -v -R [user_name]:[group_name] [file_name]
Example
# chown -v -R root:jenkins temp.txt