Users and GroupsLinux is a multi-user operating system.

This means not only that multiple user ids can be created (common across all mainstream OS’s today), but that they can all access the same Linux machine simultaneously.

You are, of course, limited to roughly 4,294,967,296 user names, but as long as you’re only creating a single user name for 59.65% of the world’s 7.2 billion population, you shouldn’t run into any problems.

User names are unique on each computer and/or service. This explains why you can use whatever user name you want on your own machine, but why you might have trouble even finding an available user name at your chosen email service provider — chances are somebody else already got the one you wanted.

The ability to manage users — even on your personal computer — is useful for many reasons (especially on your personal computer). You can create multiple user ids for yourself, to be able to separate your work life/files/settings from your personal life/files/settings, or have a backup user name available in case a friend or relative needs to use your computer.

Whatever the reason, a good background in user management — from the command line! — is useful to have.

Just to clarify the obvious, your user name is the means that your computer uses to identify you so that it can help you out, but it also determines what you are and are not allowed to do/access/etc.

Groups run hand-in-hand with users and permissions. They help to control who has access to what. Permissions, on the other hand, are a large enough topic to warrant their own discussion at a later date.

So let’s jump right into some of the most common user and group management commands and see what’s what.

User Management


The useradd command will add a new user to the system. Example: useradd gwen


The userdel command will delete an existing user from the system. Example: userdel gwen


This command is a symbolic link to the useradd command.


This command is a symbolic link to the userdel command.


The passwd command will assign or change the password of an existing user. Execute the command and user name together and you will be prompted for the password (twice). Example: passwd gwen


The usermod command will modify an existing user account. There are options such as the ability to lock/unlock an account, change the home directory, etc.


The users command will print a list of users currently logged into the system.

Group Management


…prints the groups a user is in.


…creates a new group on the system.


…removes an existing group from the system.


…modifies a group definition on the system.


…changes group ownership of files/directories.


…logs into a new group.

User Details


…prints effective userid.


…prints real and effective user and group IDs.


…shows who is logged on and what they are doing.


…displays who is logged onto the system.


…shows a listing of last logged in users.


…user information lookup program.


…change your finger information.


…prints user’s login name.


…prints statistics about users’ connect time.


…edits the password, group, shadow-password or shadow-group file.

User Interaction


Talks with another logged-in user (if their settings allow it).


Sends a message to another user (if their settings allow it).


Sends a message to all other logged-in users (if their settings allow it).


The mesg command controls whether or not other users can send messages to you. Type in mesg to check if it “is n” (off) or “is y” (on). Type mesg y to turn it on, and mesg n to turn it off.

Switching Users & Super Users

The su command might refer to either “switch user” or “super user”, based on its context. Both terms are applicable, as the command allows you to switch to another user name within the command line, including the super user “root”.


Use the su command to switch user names. Examples: su altusername or su - (shorthand for “su root”)


The sudo “superuser do” command allows commands to be executed as another user, or by default as the super user.


The visudo command can be used to safely edit the sudoers file and give super user privileges to users other than the root user.


The exit command will log you out of another user name if you had switched to it; otherwise it will exit the terminal.


This is just an overview of the commands available to manage users and groups.

For additional details, always remember to man command.