Add a User on Ubuntu Server

Ubuntu Server is like any Linux variety, and has full multi-user capabilities, and a common task on any server is adding users.

useradd

The useradd command will let you add a new user easily from the command line:

useradd

This command adds the user, but without any extra options your user won’t have a password or a home directory.

You can use the -d option to set the home directory for the user. The -m option will force useradd to create the home directory. We’ll try creating a user account with those options, and then use the passwd command to set the password for the account. You can alternatively set a password using -p on the useradd command, but I prefer to set the password using passwd.

sudo useradd -d /home/testuser -m testuser
sudo passwd testuser

adduser

The adduser command is even easier than the useradd command, because it prompts you for each piece of information. I find it slightly funny that there are two virtually identically named commands that do the same thing, but that’s linux for you. Here’s the syntax:

adduser

ubuntu basic commands

These are some basic ubuntu commands you will have use at some point of time.

How to make a new folder ?
sudo mkdir /home/namhuy/foler

How to delete a file/folder ?
sudo rm /media/disk/file.extension
sudo rm -rf /media/disk/directory

How to to copy files ?
sudo cp /usr/local/base/..

How to to move files ?
sudo mv /usr/local/base/..