User Management Commands

Commands for managing users and their settings in Linux.

1. adduser

adduser alice

Adds a new user and sets up their home directory.

2. useradd

useradd -m bob

Alternative to adduser, more control over options.

3. passwd

passwd bob

Changes a user’s password.

4. deluser

deluser alice

Deletes a user account and optionally their home directory.

5. userdel

userdel -r bob

Removes a user and their home directory.

6. groupadd

groupadd devs

Creates a new group.

7. groupdel

groupdel devs

Deletes a group.

8. usermod

usermod -aG sudo bob

Adds a user to a group.

9. id

id bob

Shows user ID, group ID, and group memberships.

10. groups

groups alice

Displays groups the user belongs to.

11. whoami

whoami

Prints the current user name.

12. su

su - alice

Switches to another user session.

13. sudo

sudo command

Executes command with superuser privileges.

14. chage

chage -l alice

Displays or modifies user password expiry settings.

15. finger

finger bob

Shows information about a user account.

16. last

last

Displays recent logins by users.