Back to commands

Linux Survival Basics

Read-only, sensitive output

Show 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.

  1. groups username
  2. groups username

next steps

Related commands

Linux Survival Basics Sensitive output

Check a User Identity Record

Start sudo troubleshooting with the actual target account.

id username
Linux Survival Basics Read-only

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
Linux Survival Basics Sensitive output

List sudo Group Members

Before granting sudo, see who already has it.

getent group sudo

next diagnostic step

Where to go from this command

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.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.