Add an user to Ubuntu Linux from command line
If you want to add an user to your Ubuntu Linux machine here is what you need to do. Login as root (or use sudo) and then run (as root):
useradd -d /home/john -m john passwd john usermod -aG sudo john
If you are not root run:
sudo useradd -d /home/john -m john sudo passwd john sudo usermod -aG sudo john
In our example john is the user we want to add. Last command (usermod) will allow our user to run root commands via sudo.