Quiz Entry - updated: 2026.07.14
What is the id command and what information does it show?
id prints the identity the kernel actually uses for you right now: your UID, your primary GID, and every group you belong to — both as numbers and names.
It's the quickest way to answer "why can/can't I touch this file?" — because permissions are decided against exactly these IDs. If you were just added to a group but id doesn't show it, you haven't re-logged-in yet. Related shortcuts: whoami (just the username) and groups (just the group names).
id
uid=1004(labstudent) gid=1004(labstudent) groups=1004(labstudent),10(wheel)
Breakdown:
| Part | Meaning |
|---|---|
uid=1004(labstudent) |
User ID and username |
gid=1004(labstudent) |
Primary group ID and name |
groups=... |
All groups (primary + supplementary) |
Options:
id # Full info for current user
id username # Info for specific user
id -u # Just UID
id -g # Just primary GID
id -G # All GIDs (numeric)
id -Gn # All group names
Related commands:
whoami # Just username
groups # Just group names
Use case: Check if you're in a required group before accessing protected resources.