How to change files owner and group in Linux?

To change a file’s owner or a group, you will need to use the ‘chown‘ command.

Here are some examples:

To change a single file owner, type in ‘chown newowner yourfile

To change a single file and group name, type in ‘chown newowner:newgroup yourfile

To change a directory, type in ‘chown -R newowner yourdirectory

* newowner = the new owner name
* newgroup = the new group name
* yourfile and yourdirectory = the name of the file or directory

For changing only the Group name, you can use the ‘chgrp’ command instead. The syntax is the same as ‘chown’.

Also, remember you can always use the ‘man command’ if you need help on the syntax for a command in Linux.