update .Os and history from .Ud to .Bx 4.4
[unix-history] / usr / src / usr.bin / id / id.1
CommitLineData
2242702a
KB
1.\" Copyright (c) 1991 The Regents of the University of California.
2.\" 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.\"
3839a0e1 9.\" @(#)id.1 5.5 (Berkeley) %G%
2242702a
KB
10.\"
11.Dd ""
12.Dt ID 1
3839a0e1 13.Os BSD 4.4
2242702a
KB
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
d500843c
KB
27.Fl p
28.Nm id
2242702a
KB
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.
7ac05a89 36If the real and effective IDs are different, both are displayed,
2242702a
KB
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
7ac05a89
KB
48Display the different group IDs (effective, real and supplementary)
49as white-space separated numbers, in no particular order.
2242702a 50.It Fl g
7ac05a89 51Display the effective group ID as a number.
2242702a 52.It Fl n
7ac05a89
KB
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.
d500843c
KB
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.
2242702a 77.It Fl r
7ac05a89
KB
78Display the real ID for the
79.Fl g
80and
81.Fl u
82options instead of the effective ID.
2242702a 83.It Fl u
7ac05a89 84Display the effective user ID as a number.
2242702a
KB
85.El
86.Pp
2242702a 87The
2242702a
KB
88.Nm id
89utility exits 0 on success, and >0 if an error occurs.
90.Sh SEE ALSO
d500843c 91.Xr who 1
2242702a
KB
92.Sh STANDARDS
93The
15776c59 94.Nm id
2242702a
KB
95function is expected to conform to
96.St -p1003.2 .
97.Sh HISTORY
98The
15776c59
KB
99historic
100.Xr groups 1
d500843c
KB
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 .
15776c59
KB
109.Pp
110The
2242702a 111.Nm
3839a0e1
CL
112command appears in
113.Bx 4.4 .