id

displays user and group identity information

TLDR

Show current user info
$ id
Show info for user
$ id [username]
Show only user ID
$ id -u
Show only group ID
$ id -g
Show all group IDs
$ id -G
Show names instead of numbers
$ id -n -u

SYNOPSIS

id [options] [user]

DESCRIPTION

id displays user and group identity information. It shows UID, GID, and supplementary groups for users.The command is useful for verifying permissions and group memberships. It can query any user or the current user by default.

PARAMETERS

USER

Username to query.
-u, --user
Print user ID only.
-g, --group
Print primary group ID.
-G, --groups
Print all group IDs.
-n, --name
Print names instead of IDs.
-r, --real
Print real ID.
--help
Display help information.

INSTALL

sudo apt install coreutils
sudo dnf install coreutils
sudo pacman -S coreutils
sudo apk add coreutils
sudo zypper install coreutils
brew install coreutils
nix profile install nixpkgs#coreutils

CAVEATS

Part of coreutils. Shows cached info at login. Real vs effective ID support.

HISTORY

id is a standard Unix command, part of GNU coreutils on Linux.

SEE ALSO

whoami(1), groups(1), users(1)