How to list users, add users, edit users and more in Ubuntu 12.04

Commands to list all current users, add a new user, delete an existing user, backup and/or delete a user’s home directory, rename a user, change a user’s password, etc. from an Ubuntu 12.04 command-line terminal.

 Posted March 26, 2016

To list all users you can use:

To add a new user you can use:

This command is more user-friendly than adduser. PERL script which uses useradd in the backend.
or:

Less user-friendly than adduser, but see What is the difference between adduser and useradd?

To remove/delete a user, first you can use:

Then you may want to delete the home directory for the deleted user account:

Use with caution! If you’re unsure, first back up the home directory using the command below:

To modify the username of a user:

To change the password for a user:

To change the shell for a user:

To change the details for a user (for example real name):

And, of course, see also: man adduser, man useradd, man userdel… and so on.

Note: This is a modified version of this answer on AskBuntu which was so concise.

Leave a Reply

Your email address will not be published. Required fields are marked *