User Management
whoami
Display the current logged-in username.
whoami → Outputs the current user's username.
who
Show logged-in users and their activities.
who → Lists all logged-in users with session details.
adduser [name]
Add a new user to the system.
sudo adduser john → Creates a new user john.
passwd [user]
Change the password for a user.
sudo passwd john → Changes john's password.
usermod -aG [group] [user]
Add an existing user to a group.
sudo usermod -aG sudo john → Adds john to the sudo group.
id [user]
Display user and group ID information.
id john → Displays the UID and GID of john.
deluser [name]
Remove a user from the system.
sudo deluser john → Deletes the user john.
groups [user]
Show the groups a user belongs to.
groups john → Displays the groups that john is a part of.
Last updated