Quickly inspect numeric and named user and group identities from the shell. 14.12.2025 | reading time: 2 min On a Linux shell the `id` command reveals a process' user and group identity; run it before changing permissions or running scripts to avoid surprises. Quick demo Run these commands to see typical outputs: ``` $ id uid=1001(alice) gid=1001(alice) groups=1001(alice),27(sudo) $ id -u 1001 $ id -n -u alice $ id bob uid=1002(bob) gid=1002(bob) groups=1002(bob) ``` Effective and real identities `id` shows the effective IDs by default; use the real-IDs option if you need the process' real user or group (useful when dealing with setuid binaries) and note that effective and real IDs can differ for privilege separation. Quick scripting patterns Capture numeric or named IDs in scripts and make decisions: ``` UID=$(id -u) if [ "$UID" -eq 0 ]; then echo "running as root" else echo "running as UID $UID" fi ``` Other identity helpers When you need specific slices of identity information use whoami for the current username, groups to list group names, getent passwd to resolve entries from NSS, and on SELinux-enabled systems use id -Z to show the security context. Final note and next step Mastering id and its patterns is a small but vital step toward confident Linux administration; deepen that skill and consider pursuing CompTIA Linux+ or LPIC-1 exam preparation with bitsandbytes.academy for intensive hands-on training. Join Bits & Bytes Academy First class LINUX exam preparation. utilities security processes scripting