What does id do?

print user and group identity (UID, GID, groups).

▸ Explain your own id command →

id examples, explained

$ id

  • idprint user and group identity (UID, GID, groups)

$ id -u

  • idprint user and group identity (UID, GID, groups)
  • -uprint only the effective user ID

$ id -un

  • idprint user and group identity (UID, GID, groups)
  • -uprint only the effective user ID
  • -nprint names instead of numeric IDs

$ id -Gn alice

  • idprint user and group identity (UID, GID, groups)
  • -Gprint all group IDs the user belongs to
  • -nprint names instead of numeric IDs
  • alicean argument passed to the command

id flags & options

-uprint only the effective user ID
-gprint only the effective (primary) group ID
-Gprint all group IDs the user belongs to
-nprint names instead of numeric IDs
-rprint the real ID instead of the effective one

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.