To change the owner of a file or directory, the
chown command can be used, which stands for change owner. For this, two parameters are required: the new owner and the file or directory that requires new ownership, as shown here:
packt@PacktPublishing:~$ chown packt /tmp/testdir
To change the group membership of a file, a similar command to
chgroup, which stands for change group, exists and works identically.