Sync usage with man page.
[netbsd-mini2440.git] / usr.bin / id / id.1
blob1d495455331595f7eaac25d9f3f791367826ebbb
1 .\"     $NetBSD: id.1,v 1.11 2003/08/07 11:14:06 agc Exp $
2 .\"
3 .\" Copyright (c) 1991, 1993, 1994
4 .\"     The Regents of the University of California.  All rights reserved.
5 .\"
6 .\" This code is derived from software contributed to Berkeley by
7 .\" the Institute of Electrical and Electronics Engineers, Inc.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\"    may be used to endorse or promote products derived from this software
19 .\"    without specific prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\"
33 .\"     @(#)id.1        8.2 (Berkeley) 5/5/94
34 .\"
35 .Dd May 5, 1994
36 .Dt ID 1
37 .Os
38 .Sh NAME
39 .Nm id
40 .Nd return user identity
41 .Sh SYNOPSIS
42 .Nm
43 .Op Ar user
44 .Nm
45 .Fl G Op Fl n
46 .Op Ar user
47 .Nm
48 .Fl g Op Fl nr
49 .Op Ar user
50 .Nm
51 .Fl p
52 .Op Ar user
53 .Nm
54 .Fl u Op Fl nr
55 .Op Ar user
56 .Sh DESCRIPTION
57 The
58 .Nm
59 utility displays the user and group names and numeric IDs, of the
60 calling process, to the standard output.
61 If the real and effective IDs are different, both are displayed,
62 otherwise only the real ID is displayed.
63 .Pp
64 If a
65 .Ar user
66 (login name or user ID)
67 is specified, the user and group IDs of that user are displayed.
68 In this case, the real and effective IDs are assumed to be the same.
69 .Pp
70 The options are as follows:
71 .Bl -tag -width Ds
72 .It Fl G
73 Display the different group IDs (effective, real and supplementary)
74 as white-space separated numbers, in no particular order.
75 .It Fl g
76 Display the effective group ID as a number.
77 .It Fl n
78 Display the name of the user or group ID for the
79 .Fl G ,
80 .Fl g
81 and
82 .Fl u
83 options instead of the number.
84 If any of the ID numbers cannot be mapped into names, the number will be
85 displayed as usual.
86 .It Fl p
87 Make the output human-readable.
88 If the user name returned by
89 .Xr getlogin 2
90 is different from the login name referenced by the user ID, the name
91 returned by
92 .Xr getlogin 2
93 is displayed, preceded by the keyword ``login''.
94 The user ID as a name is displayed, preceded by the keyword ``uid''.
95 If the effective user ID is different from the real user ID, the real user
96 ID is displayed as a name, preceded by the keyword ``euid''.
97 If the effective group ID is different from the real group ID, the real group
98 ID is displayed as a name, preceded by the keyword ``rgid''.
99 The list of groups to which the user belongs is then displayed as names,
100 preceded by the keyword ``groups''.
101 Each display is on a separate line.
102 .It Fl r
103 Display the real ID for the
104 .Fl g
106 .Fl u
107 options instead of the effective ID.
108 .It Fl u
109 Display the effective user ID as a number.
114 utility exits 0 on success, and \*[Gt]0 if an error occurs.
115 .Sh SEE ALSO
116 .Xr who 1
117 .Sh STANDARDS
120 function is expected to conform to
121 .St -p1003.2 .
122 .Sh HISTORY
124 historic
125 .Xr groups 1
126 command is equivalent to
127 .Dq Nm id Fl Gn Op Ar user .
130 historic
131 .Xr whoami 1
132 command is equivalent to
133 .Dq Nm id Fl un .
137 command first appeared in
138 .Bx 4.4 .