chown command examples and its how to

This command is used to change the file owner and or group of a file or directory. The ownership of a file or directory defines which user and group have control over file, like permission to read, write or execute. It comes from “coreutils-x.x” package.

Examples:

1. To change the owner of the file

$ chown mike file.txt

2. To see if the changes have taken place or not

$ chown -c mike file.txt

3. To suppress if any error messages

$ chown -f mike file.txt

4. To apply the changes recursively

$ chown -R mike /mydir

5. To change the file owner and group at once

$ chown mike:SUPPORT file.txt

Leave a Reply

Your email address will not be published. Required fields are marked *