Chown is the command for changing the owner (and group) of files.

The usual way of using it is by specifying the name of the user like:

$ chown sam music.mp3

If you also want to set the group for this user you can do it by executing

$ chown sam:sam music.mp3

There is another way of doing it is by using a dot '.' but is deprecated, though:

$ chown sam.sam music.mp3

The reason why is deprecated is because there are users than can have a dot character in its username so avoid its usage when possible:

Some older scripts may still use '.' in place of the ':' separator. POSIX 1003.1-2001 (see Standards conformance) does not require support for that, but for backward compatibility GNU chown supports '.' so long as no ambiguity results. New scripts should avoid the use of '.' because it is not portable, and because it has undesirable results if the entire owner'.'group happens to identify a user whose name contains '.'.

If you only want to change the group you can simply use the command chgrp. But if you want to use chown you can execute:

$ chown :sam music.mp3

This is the one I've learnt recently and I think is very interesting. If you want to set the same user and group to a file, intead of specifying both user/group you can do instead:

$ chown sam: music.mp3

This will set 'sam' as both user and group for the file.

Take care, Jan.