addgroup vs groupadd

I happen to know there is a slight difference between adduser and useradd.
(i.e., adduser has additional features to useradd, such as creating a home directory.)

Then what is the relation between addgroup and groupadd?
Is there a preferred way to create a group?

Asked By: e9t


On most distribution adduser and addgroup are interactive ‘convenience’ wrappers around the commands useradd and groupadd.

You can find addgroup using the command which addgroup, on my machine (Ubuntu 11.04) this lives in /usr/sbin/addgroup.

On my box addgroup is a perl script that prompts for various options (interactively) before invoking the groupadd command.

groupadd is usually preferable for scripting (say, if you wan’t to create users in batch), whereas addgroup is more user friendly (especially if you are unfamiliar with all the options and flags).

Of course addgroup also takes many options via the command when you invoke it, but it is primarily intended as an interactive script.

Interestingly on my box addgroup is a symlink to adduser, the script checks the name it was invoked under and performs different actions accordingly.

Answered By: cjh

groupadd is more preferable for better cross-linux and sometimes cross-unix systems compatibility.

addgroup is often just a wrapper over groupadd (written in perl, source code here).

In the same way, useradd is more preferable than addusersee here

Answered By: sqr163
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.