24

I know what chgrp and chown do.
My question is since chown does the same thing as chgrp (and even more), what is the point of chgrp?

3
  • 4
    Unix philosophy: One tool to do one thing. Make a simple and work. Not complex. Commented Oct 29, 2014 at 17:12
  • 11
    Historically, the chown command accepted only a new owner, or maybe owner[:group]. You couldn't say just chown :groupname, so the chgrp command was necessary. Commented Oct 29, 2014 at 17:19
  • chown :groupname works fine for me. Commented Feb 24, 2018 at 7:34

2 Answers 2

15

When you use chgrp you are using a simple tool to change one thing... group permissions. For many people this is preferred over using chown, especially when you run the risk of mistyping a character while using the chown command and completely breaking permissions to whatever files/folder you specified.

So instead of doing one of the following:

chown user:group [file/dir] chown :group [file/dir] 

You just do:

chgrp group [file/dir] 

This keeps the risks of changing file permissions in a production grade environment down. Which is always good for SysAdmins.

2

Remember:

  • A file is owned by exactly one group and one user. That file may have varying permissions depending on the user and/or group attempting to use it.
  • chown changes ownership of files to specified user/group
  • chmod changes permissions of files to specified user/group
  • chgrp changes ownership of files to specified group

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.