chown [User]:[Group] [File]
chown -R [User]:[Group] [Folder]
Change Only The Owner
Example: chown -R john /project/alpha
Scenario: A project manager creates a directory named /project/alpha. Now that the directory is finished, a researcher named john needs full control over the folder to begin data entry.
Result: John now has "owner" permissions (which usually include read, write, and the ability to change permissions), but the folder remains associated with whatever group originally owned it.
Change Only The Group
Function identical to chgrp
Example: chown -R :devs /project/alpha
Scenario: A lead developer owns /project/alpha, but it needs to be accessible to the entire devs (development) team for collaborative auditing.
Result: The lead developer remains the primary owner, but anyone belonging to the devs group now gains "group-level" permissions (often read and write) as defined in the folder’s metadata.
Change Owner And Group
Example: chown -R john:devs /project/alpha
Scenario: A system administrator is migrating a project from a departing contractor to a new department. /project/alpha needs to be moved to devs department and john as project lead.
Result: In a single execution, john becomes the owner, and the devs group becomes the associated group. The previous owner and group lose their respective ownership privileges.
chgrp [Group] [File]
chgrp -R [Group] [Folder]
Function identical to chown :[Group] [File/Folder]
ls -l [File]
ls -ld [Folder]
3rd column --> File/folder owner
4th column --> Group owner
Example:
-rw-r--r--. 1 john devs 12540 Apr 8 11:22 log.txt
-rw-r--r--. 1 john devs 12540 Apr 8 11:22 /project/alpha