User Management Commands in Linux (original) (raw)

Last Updated : 22 Dec, 2025

User management commands in Linux are used to create, modify, and manage user accounts on the system. These commands help administrators control user access, manage passwords, view user information, and maintain a secure multi-user environment.

user_management_commands

The following commands are used for user management in Linux.

1. chage

The chage command is used to view and modify password aging information for a user account. It helps enforce password expiry and security policies.

**Syntax:

chage [options] username

**Example:

chage -l vboxuser

2. chfn

The chfn command is used to change user information such as full name and contact details. It updates the user’s finger information.

**Syntax:

chfn username

**Example:

chfn

Basic 'chfn' command Example

3. chsh

The chsh command is used to change a user’s default login shell. It defines which shell starts when the user logs in.

**Syntax:

chsh username

**Example:

chsh vboxuser

4. chpasswd

The chpasswd command is used to change passwords for multiple users in batch mode. It reads user and password pairs from standard input.

**Syntax:

chpasswd

**Example:

echo "vboxuser:newpass" | chpasswd

5. finger

The finger command displays detailed information about user accounts. It shows login name, home directory, and last login.

**Syntax:

finger username

**Example:

finger manav

To-finger-or-get-details-of-a-user

6. id

The id command displays user ID (UID), group ID (GID), and group memberships. It helps identify user privileges.

**Syntax:

id username

**Example:

id master

7. passwd

The passwd command is used to change a user’s password. Users can change their own password, while administrators can change others’.

**Syntax:

passwd username

**Example:

passwd user1

How to change another user password

8. pinky

The pinky command is a lightweight version of finger. It displays brief user information.

**Syntax:

pinky username

**Example:

pinky manav

To-get-the-report-of-a-single-user

9. username

The username command is used to fetch username-related information from the system. It helps identify user-related configurations.

**Syntax:

username

**Example:

id vboxuser

4

10. useradd

The useradd command is used to create a new user account on the system. It sets up the user’s home directory and default settings.

**Syntax:

useradd username

**Example:

useradd test_user

11. userdel

The userdel command is used to delete an existing user account. It can also remove the user’s home directory.

**Syntax:

userdel username

**Example:

userdel user1

12. usermod

The usermod command is used to modify existing user account properties. It can change username, groups, and login options.

**Syntax:

usermod [options] username

**Example:

usermod -aG sudo user1

13. users

The users command displays the usernames of currently logged-in users. It gives a quick overview of active users.

**Syntax:

users

**Example:

users

file

14. who

The who command shows detailed information about logged-in users. It displays login time and terminal details.

**Syntax:

who

Example:

who

2

15. whoami

The whoami command displays the username of the currently logged-in user. It is useful in scripts and multi-user systems.

**Syntax:

whoami

**Example:

whoami

1