Permissions, users and access

Command id

Show UID, GID and groups

Linux · Bash examples · commands run on the selected server

When to use id

Use id to verify which account and groups a shell command uses. This is more reliable than a prompt label when switching accounts or checking permissions within automated tasks.

Syntax

id [OPTIONS] [USER]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-u
Show user ID.
-g
Show main group.
-G
Show all groups; -n prints names instead of numbers.

Usage examples

Check current account

id

User and group identities are displayed, including supplementary groups.

Show UID

id -u

Only the effective numeric user ID is printed.

Check user groups

id -nG deploy

The named account's group names are shown for membership inspection.

Notes and limitations

  • Without a name, the identity of the current process is displayed.
  • The numbers UID and GID are important for permissions on disk, containers, and network file systems.

Common questions and troubleshooting

Why does the prompt name disagree with id?

Prompts are configurable text and may be stale. Use identity commands and effective permissions to determine the actual execution account.

What does user ID zero mean?

It is the privileged root identity on typical Linux systems. Avoid running ordinary inspection or file operations as that account when not necessary.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man id.