Change file ownership

The chown (stands for change owner) command is used to change the ownership of a file in Linux. In its most basic form, you just provide the name of the new owner and the filename:


For example, here is the command that will change the owner of the file called bobs_file.txt to jwilliams:

linux chown command

You can also change both the file owner and the group of the file using the chown command. The syntax looks like this:


Let’s change the owner and the group of the bobs_file.txt:

linux chown change owner and group

To change only the group of the file, you can omit the NEW_OWNER parameter:

linux chown change group


You can also change the group of a file using the chgrp command. The syntax of this command is simple: chgrp NEW_GROUP FILE_NAME. As with chown, you can use the -R option to allow changes to be applied recursively to all selected files and subdirectories.

Subscribe to our Newsletter

Like us on Facebook

Geek University 2019