xref: /original-bsd/usr.bin/id/id.1 (revision deff14a8)
1.\" Copyright (c) 1991, 1993, 1994
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
7.\" %sccs.include.redist.roff%
8.\"
9.\"	@(#)id.1	8.2 (Berkeley) 05/05/94
10.\"
11.Dd ""
12.Dt ID 1
13.Os BSD 4.4
14.Sh NAME
15.Nm id
16.Nd return user identity
17.Sh SYNOPSIS
18.Nm id
19.Op Ar user
20.Nm id
21.Fl G Op Fl n
22.Op Ar user
23.Nm id
24.Fl g Op Fl nr
25.Op Ar user
26.Nm id
27.Fl p
28.Nm id
29.Fl u Op Fl nr
30.Op Ar user
31.Sh DESCRIPTION
32The
33.Nm id
34utility displays the user and group names and numeric IDs, of the
35calling process, to the standard output.
36If the real and effective IDs are different, both are displayed,
37otherwise only the real ID is displayed.
38.Pp
39If a
40.Ar user
41(login name or user ID)
42is specified, the user and group IDs of that user are displayed.
43In this case, the real and effective IDs are assumed to be the same.
44.Pp
45The options are as follows:
46.Bl -tag -width Ds
47.It Fl G
48Display the different group IDs (effective, real and supplementary)
49as white-space separated numbers, in no particular order.
50.It Fl g
51Display the effective group ID as a number.
52.It Fl n
53Display the name of the user or group ID for the
54.Fl G ,
55.Fl g
56and
57.Fl u
58options instead of the number.
59If any of the ID numbers cannot be mapped into names, the number will be
60displayed as usual.
61.It Fl p
62Make the output human-readable.
63If the user name returned by
64.Xr getlogin 2
65is different from the login name referenced by the user ID, the name
66returned by
67.Xr getlogin 2
68is displayed, preceded by the keyword ``login''.
69The user ID as a name is displayed, preceded by the keyword ``uid''.
70If the effective user ID is different from the real user ID, the real user
71ID is displayed as a name, preceded by the keyword ``euid''.
72If the effective group ID is different from the real group ID, the real group
73ID is displayed as a name, preceded by the keyword ``rgid''.
74The list of groups to which the user belongs is then displayed as names,
75preceded by the keyword ``groups''.
76Each display is on a separate line.
77.It Fl r
78Display the real ID for the
79.Fl g
80and
81.Fl u
82options instead of the effective ID.
83.It Fl u
84Display the effective user ID as a number.
85.El
86.Pp
87The
88.Nm id
89utility exits 0 on success, and >0 if an error occurs.
90.Sh SEE ALSO
91.Xr who 1
92.Sh STANDARDS
93The
94.Nm id
95function is expected to conform to
96.St -p1003.2 .
97.Sh HISTORY
98The
99historic
100.Xr groups 1
101command is equivalent to
102.Dq Nm id Fl Gn Op Ar user .
103.Pp
104The
105historic
106.Xr whoami 1
107command is equivalent to
108.Dq Nm id Fl un .
109.Pp
110The
111.Nm id
112command first appeared in
113.Bx 4.4 .
114