2 chown

This command is used to change the ownership of files and directories. It can used to change the group ownership or user ownership, or both. As usual, the best way to learn this command is to use the man page. Type man chown on a command line interface and you will learn all the options of this command.

Here is a few examples.

To change the user owner of the file secret to delenn, use the following command:

chown delenn secret  
  

To change the group owner of the file secret to greycouncil, use the following command:

chown :greycouncil secret  
  

You can change both the user owner and group owner at the same time using the following command:

chown delenn:greycouncil secret  
  

This command can also apply to directories. In order to apply a change of ownership to not only the directory, but all the subdirectories and files, you can use the “-R” option. For example, to change the ownerships of all the files in the directory ~delenn/communicate, the following command can be used:

chown -R :greycouncil ~delenn/communicate