chown – change owner of a file or folder

chown - change owner of a file or folder

Syntax:chown <new owner>(:<new group>) <file/directory>

Explanation:chown is an abbreviation for change owner.
With chown you can change the owner of a certain file or folder.

Examples

chown john myfile.txt Change the owner of the file “myfile.txt” to the user called “john”.
chown john:group2 myfile.txt Change the owner and group membership of the file, where “john” is the name of the new owner, and “group2” is the name of the new group this file will belong to
chown - change owner of a file or folder

Quick tip

Sometimes you might not be able to perform a certain command or task from the Terminal. This might be because you don’t have the right permission to do so. When that happens you can try to add the word “sudo” in the beginning of the line.

Sudo is an abbreviation of superuser do and means that you want to execute the following command as a user with extended permissions, most often as an Administrator. When using “sudo” you sometimes need to enter the password of the root account.

Related sections