Commit | Line | Data |
---|---|---|
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 | |
32 | The | |
33 | .Nm id | |
34 | utility displays the user and group names and numeric IDs, of the | |
35 | calling process, to the standard output. | |
7ac05a89 | 36 | If the real and effective IDs are different, both are displayed, |
2242702a KB |
37 | otherwise only the real ID is displayed. |
38 | .Pp | |
39 | If a | |
40 | .Ar user | |
41 | (login name or user ID) | |
42 | is specified, the user and group IDs of that user are displayed. | |
43 | In this case, the real and effective IDs are assumed to be the same. | |
44 | .Pp | |
45 | The options are as follows: | |
46 | .Bl -tag -width Ds | |
47 | .It Fl G | |
7ac05a89 KB |
48 | Display the different group IDs (effective, real and supplementary) |
49 | as white-space separated numbers, in no particular order. | |
2242702a | 50 | .It Fl g |
7ac05a89 | 51 | Display the effective group ID as a number. |
2242702a | 52 | .It Fl n |
7ac05a89 KB |
53 | Display the name of the user or group ID for the |
54 | .Fl G , | |
55 | .Fl g | |
56 | and | |
57 | .Fl u | |
58 | options instead of the number. | |
59 | If any of the ID numbers cannot be mapped into names, the number will be | |
60 | displayed as usual. | |
d500843c KB |
61 | .It Fl p |
62 | Make the output human-readable. | |
63 | If the user name returned by | |
64 | .Xr getlogin 2 | |
65 | is different from the login name referenced by the user ID, the name | |
66 | returned by | |
67 | .Xr getlogin 2 | |
68 | is displayed, preceded by the keyword ``login''. | |
69 | The user ID as a name is displayed, preceded by the keyword ``uid''. | |
70 | If the effective user ID is different from the real user ID, the real user | |
71 | ID is displayed as a name, preceded by the keyword ``euid''. | |
72 | If the effective group ID is different from the real group ID, the real group | |
73 | ID is displayed as a name, preceded by the keyword ``rgid''. | |
74 | The list of groups to which the user belongs is then displayed as names, | |
75 | preceded by the keyword ``groups''. | |
76 | Each display is on a separate line. | |
2242702a | 77 | .It Fl r |
7ac05a89 KB |
78 | Display the real ID for the |
79 | .Fl g | |
80 | and | |
81 | .Fl u | |
82 | options instead of the effective ID. | |
2242702a | 83 | .It Fl u |
7ac05a89 | 84 | Display the effective user ID as a number. |
2242702a KB |
85 | .El |
86 | .Pp | |
2242702a | 87 | The |
2242702a KB |
88 | .Nm id |
89 | utility exits 0 on success, and >0 if an error occurs. | |
90 | .Sh SEE ALSO | |
d500843c | 91 | .Xr who 1 |
2242702a KB |
92 | .Sh STANDARDS |
93 | The | |
15776c59 | 94 | .Nm id |
2242702a KB |
95 | function is expected to conform to |
96 | .St -p1003.2 . | |
97 | .Sh HISTORY | |
98 | The | |
15776c59 KB |
99 | historic |
100 | .Xr groups 1 | |
d500843c KB |
101 | command is equivalent to |
102 | .Dq Nm id Fl Gn Op Ar user . | |
103 | .Pp | |
104 | The | |
105 | historic | |
106 | .Xr whoami 1 | |
107 | command is equivalent to | |
108 | .Dq Nm id Fl un . | |
15776c59 KB |
109 | .Pp |
110 | The | |
2242702a | 111 | .Nm |
3839a0e1 CL |
112 | command appears in |
113 | .Bx 4.4 . |