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