III —:::— Crystal

id – print real and effective user and group IDs

A UNIX Command
$id
uid=1000(jeffrin) gid=1000(jeffrin) groups=1000(jeffrin),29(audio),1001(wireshark)
$id -n
id: cannot print only names or real IDs in default format
$id -a
uid=1000(jeffrin) gid=1000(jeffrin) groups=1000(jeffrin),29(audio),1001(wireshark)
$id -g
1000
$id -G
1000 29 1001
$id -Gn
jeffrin audio wireshark
$id -r
id: cannot print only names or real IDs in default format
$id -rG
1000 29 1001
$id -u
1000
$id -un
jeffrin
$

UNIX Explanation

GNU/Linux Based Explanation
Print  user  and  group  information  for  the  specified
USERNAME, or (when USERNAME omitted) for the current user

SunOS Based Explanation
If no user operand is provided, the id utility writes the
user and  group IDs and the corresponding  user and group
names of the invoking process to standard output.  If the
effective and real IDs do not match, both are written. If
multiple groups  are supported by  the underlying system,
/usr/xpg4/bin/id  also  writes  the  supplementary  group
affiliations of the invoking process.


If a  user operand  is provided and  the process  has the
appropriate  privileges, the  user and  group IDs  of the
selected user  are written.  In this  case, effective IDs
are assumed to be identical  to real IDs. If the selected
user has more than  one allowable group membership listed
in  the group database,  /usr/xpg4/bin/id writes  them in
the same manner as  the supplementary groups described in
the preceding paragraph.

FreeBSD Based Explanation
The  id utility  displays the  user and  group  names and
numeric  IDs, of  the  calling process,  to the  standard
output.   If the  real and  effective IDs  are different,
both are  displayed, otherwise only  the real ID  is dis-
played.

If a user (login name  or user ID) is specified, the user
and group IDs of that  user are displayed.  In this case,
the real and effective IDs are assumed to be the same.