chown : Change Owner And Group File or Directory

We can get information from a file in Linux with command :

ls -l

This is output from my file :

-rw-r–r– 1 root root 0 2011-03-09 13:50 tesfile

If we want to change file owner and group this file from root to toto, we can use this command :

chown root:toto tesfile

This command will change group file. Check  status of file  with command ls -l

-rw-r–r–  1 root toto         0 2011-03-09 13:50 tesfile

Change owner of file with command :

chown toto tesfile

Check  status of file  with command ls -l

-rw-r–r–  1 toto toto         0 2011-03-09 13:50 tesfile

If we want to change owner and group file or directory with all subdirectory, we can add option -R in chown command.

3 Comments

Add a Comment

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