]> git.saurik.com Git - apple/shell_cmds.git/blame - id/id.1
shell_cmds-34.tar.gz
[apple/shell_cmds.git] / id / id.1
CommitLineData
44bd5ea7
A
1.\" $NetBSD: id.1,v 1.7 1997/10/19 02:45:47 lukem 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. All advertising materials mentioning features or use of this software
18.\" must display the following acknowledgement:
19.\" This product includes software developed by the University of
20.\" California, Berkeley and its contributors.
21.\" 4. Neither the name of the University nor the names of its contributors
22.\" may be used to endorse or promote products derived from this software
23.\" without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35.\" SUCH DAMAGE.
36.\"
37.\" @(#)id.1 8.2 (Berkeley) 5/5/94
38.\"
39.Dd May 5, 1994
40.Dt ID 1
41.Os BSD 4.4
42.Sh NAME
43.Nm id
44.Nd return user identity
45.Sh SYNOPSIS
46.Nm
47.Op Ar user
48.Nm ""
49.Fl G Op Fl n
50.Op Ar user
51.Nm ""
52.Fl g Op Fl nr
53.Op Ar user
54.Nm ""
55.Fl p
56.Nm ""
57.Fl u Op Fl nr
58.Op Ar user
59.Sh DESCRIPTION
60The
61.Nm
62utility displays the user and group names and numeric IDs, of the
63calling process, to the standard output.
64If the real and effective IDs are different, both are displayed,
65otherwise only the real ID is displayed.
66.Pp
67If a
68.Ar user
69(login name or user ID)
70is specified, the user and group IDs of that user are displayed.
71In this case, the real and effective IDs are assumed to be the same.
72.Pp
73The options are as follows:
74.Bl -tag -width Ds
75.It Fl G
76Display the different group IDs (effective, real and supplementary)
77as white-space separated numbers, in no particular order.
78.It Fl g
79Display the effective group ID as a number.
80.It Fl n
81Display the name of the user or group ID for the
82.Fl G ,
83.Fl g
84and
85.Fl u
86options instead of the number.
87If any of the ID numbers cannot be mapped into names, the number will be
88displayed as usual.
89.It Fl p
90Make the output human-readable.
91If the user name returned by
92.Xr getlogin 2
93is different from the login name referenced by the user ID, the name
94returned by
95.Xr getlogin 2
96is displayed, preceded by the keyword ``login''.
97The user ID as a name is displayed, preceded by the keyword ``uid''.
98If the effective user ID is different from the real user ID, the real user
99ID is displayed as a name, preceded by the keyword ``euid''.
100If the effective group ID is different from the real group ID, the real group
101ID is displayed as a name, preceded by the keyword ``rgid''.
102The list of groups to which the user belongs is then displayed as names,
103preceded by the keyword ``groups''.
104Each display is on a separate line.
105.It Fl r
106Display the real ID for the
107.Fl g
108and
109.Fl u
110options instead of the effective ID.
111.It Fl u
112Display the effective user ID as a number.
113.El
114.Pp
115The
116.Nm
117utility exits 0 on success, and >0 if an error occurs.
118.Sh SEE ALSO
119.Xr who 1
120.Sh STANDARDS
121The
122.Nm
123function is expected to conform to
124.St -p1003.2 .
125.Sh HISTORY
126The
127historic
128.Xr groups 1
129command is equivalent to
130.Dq Nm id Fl Gn Op Ar user .
131.Pp
132The
133historic
134.Xr whoami 1
135command is equivalent to
136.Dq Nm id Fl un .
137.Pp
138The
139.Nm
140command first appeared in
141.Bx 4.4 .