Linux Survival Basics
Read-only, sensitive outputShow User Groups
You need the group list for a target user.
Command
groups username
Before you run this
System impact: Read-only. Output may expose users, paths, tokens, keys, IPs, process arguments, or log details.
When not to use it: Do not add groups before verifying policy and owner approval.
Expected output
Supplementary groups for the target username.
System impact
Read-only, sensitive output. Nothing changes. The command reads current state and prints diagnostic evidence.
Recovery / rollback: no state is changed.
When to use it
Use when sudo or file access depends on group membership.
When not to use it
Do not add groups before verifying policy and owner approval.
Example run
Commands shown
These are the commands shown for inspection. Treat them as an example, not proof that your system will behave identically.
groups usernamegroups username
next steps
Related commands
Check a User Identity Record
Start sudo troubleshooting with the actual target account.
id username
List Effective sudo Privileges
sudo -l shows policy; guessing invites bad access changes.
sudo -l
Show Context Around the First App Error
The first error often explains more than the last one.
awk '{buf[NR%5]=$0} tolower($0) ~ /(error|exception|fatal)/ {for (i=NR-4;i<=NR;i++) if (i>0) print buf[i%5]; exit}' /var/log/app/app.log
Count Open Files for One Process
Count handles for the target process before raising limits.
sudo lsof -p 1234 | wc -l
List sudo Group Members
Before granting sudo, see who already has it.
getent group sudo
next diagnostic step
Where to go from this command
- User not in sudoers hub Use to check sudo group membership.
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.