chown—changes owner of file

chown [ –fhR ] owner filename ...

chown changes the owner of the files to owner. The owner may be either a decimal user ID or a login name found in /etc/passwd file. Only the owner of a file (or the superuser) may change the owner of that file.

Example A.9.
1   chown john filex
2   chown -R ellie ellie

EXPLANATION

  1. Changes the user ID of filex to john.

  2. Recursively changes the ownership to ellie for all files in ellie directory.

Get UNIX® Shells by Example, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.