How to create a new user with a home directory in Ubuntu?

Ubuntu Linux Useradd command will create a user, but it will not create a user home directory by default. To create a user with a home directory in Ubuntu Linux, use the following syntax.

useradd -m newuser

Adding a user with home directory

For example, creating a user with a home directory using useradd -m:

root@codetryout:/home# useradd -m newuser
root@codetryout:/home#

Verifying new user home directory

Let us verify whether the home directory is created

root@codetryout:/home# ls -la /home/newuser/
total 20
drwxr-xr-x 2 newuser newuser 4096 Jan  6 17:19 .
drwxr-xr-x 6 root    root    4096 Jan  6 17:19 ..
-rw-r--r-- 1 newuser newuser  220 Feb 25  2020 .bash_logout
-rw-r--r-- 1 newuser newuser 3771 Feb 25  2020 .bashrc
-rw-r--r-- 1 newuser newuser  807 Feb 25  2020 .profile

This will work the same way across Ubuntu, RedHat Linux, CentOS, Fedora, or in Docker Linux containers.