Linux is a multi-user system, and managing users and their permissions is fundamental for security and controlling who can access and modify files and resources.
These commands allow you to get information about users and groups.
-
whoami→ Displays the username of the currently logged-in user.whoami your_username
-
id→ Shows detailed information about the current user, including the User ID (UID), Group ID (GID), and the IDs of the groups the user is a member of.id uid=1000(your_username) gid=1000(your_group) groups=1000(your_group),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),133(sambashare),999(docker)
-
groups [username]→ Lists the names of the groups that a specific user belongs to. If no username is provided, it lists the groups of the current user.groups your_username your_username : your_group adm cdrom sudo dip plugdev lpadmin sambashare dockergroups another_user another_user : another_group some_other_group