O'Reilly logo

Linux Pocket Guide, 2nd Edition by Daniel J. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

id — stdin  stdout  - file  -- opt  --help  --version

Synopsis

id [options] [username]

Every user has a unique, numeric user ID, and a default group with a unique, numeric group ID. The id command prints these values along with their associated user and group names:

$ id
uid=500(smith) gid=500(smith)
groups=500(smith),6(disk),490(src),501(cdwrite)

Useful options

-u

Print the effective user ID and exit.

-g

Print the effective group ID and exit.

-G

Print the IDs of all other groups to which the user belongs.

-n

Print names (for users and groups) rather than numeric IDs. Must be combined with -u, -g, or -G. For example, id -Gn produces the same output as the groups command.

-r

Print login values instead of effective values. Must be combined with -u, -g, or -G.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required