Linux user management – list, add, edit, delete

To list users:

getent passwd

To add a new user:

sudo adduser newuser

To change a user's password:

sudo passwd username

To change a user's username:

sudo usermod -l newUsername oldUsername

Note that this doesn't change the home directory. To change the home directory to the new username run:

usermod -d /home/newHomeDir -m newUsername

To delete a user:

sudo deluser newuser

To add a user to a group:

groups newuser

To add a user to sudoers group:

usermod -aG sudo newuser