15

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?

  • 3
    I strongly dislike this particular namescheme. Can never remember which is the more primitive of the utilities. – dubiousjim Nov 13 '12 at 14:03
  • 1
    @dubiousjim - How I do it is I remember that all convenience ones start with "add", so the primitive ones all start with the thing they are changing, ie "user'', "group", etc. – rtfminc Dec 17 '16 at 22:53
  • I find it easier to remember which is more primitive by placing the commands in alphabetical order. Alphabetically 'adduser' and 'deluser' would come first, so are more recent/higher level. Whereas 'useradd' and 'userdel' are the older/lower level commands. – JSON C11 Mar 11 at 1:45
19

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.

1

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 adduser - see here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.