The LabEx challenge Display User and Group Information is short, but it tests an important Linux reflex: before reasoning about permissions, confirm which user the shell is running as and which groups that user belongs to.
Unlike a guided lab, this is a challenge. The page gives the required outcome, but it expects you to choose the commands yourself. The solution comes from matching each requirement to the Linux command that reports exactly that information.
Problem Summary
The challenge has two tasks:
- Display the current user identity.
- Display detailed user and group information, including
uid,gid, andgroups.
That means the answer needs two levels of identity information. The first task only wants the username. The second task wants the numeric and named identity fields Linux uses for access decisions.
Step 1: Print the Current Username
For the first task, use whoami.
whoami
The expected output is only the current username. In the LabEx environment, it may look like this:
labex
This command answers a narrow question: "Which user am I right now?" It does not show groups, IDs, or permission details. That is why it is the right command for the first requirement, but not enough for the second one.
Step 2: Print User and Group Details
For the second task, use id.
id
The output should include the user ID, primary group ID, and supplementary groups:
uid=1000(labex) gid=1000(labex) groups=1000(labex),4(adm),24(cdrom),27(sudo)
The exact numbers and group names can differ between environments. What matters is the structure:
-
uid=1000(labex)means the current user has numeric user ID1000and usernamelabex. -
gid=1000(labex)means the primary group ID is1000and the group name islabex. -
groups=...lists every group membership available to the current user.
Why These Commands Solve the Challenge
whoami solves the first requirement because it prints only the current username. If the challenge asks for a single user identity, this is the cleanest output.
id solves the second requirement because it includes the fields named in the prompt: uid, gid, and groups. You do not need to inspect /etc/passwd or /etc/group for this challenge. Those files can explain account configuration, but the task asks for the identity information of the current session, and id reports that directly.
The common mistake is to stop after whoami. That confirms the username, but it does not prove group membership. In Linux permission checks, group membership can be the difference between access granted and access denied.
Final Answer
Run these two commands:
whoami
id
You have completed the challenge when the first command prints the current username and the second command prints identity details containing uid, gid, and groups.

Top comments (0)