How to Add a User From the Command Line on Linux?

There are two commands often cited for how to add a user within a Linux OS.

  • adduser
  • useradd

What Is the Difference Between adduser and useradd?

According to this article:

“adduser” is more user-friendly than useradd and is a Perl script.

adduser <username>

“useradd” is a native binary compiled with Linux.
By default, useradd doesn’t add a home directory for the user you’re creating. To do so, you’ll need the -m switch.

useradd -m <username>

Obviously “useradd”, being a native binary, has more switches and options. Check out this article for actual useradd examples and further documentation.

Related

If you’d like to lock a newly created user so that it cannot be used for log ins: usermod -L <username>

If you’d like to change a user’s password: passwd <username>