id - Unix, Linux Command


Advertisements


NAME

id - print real and effective user and group IDs

SYNOPSIS

id [OPTION]... [USERNAME]

DESCRIPTION

Print user and group information for the specified USERNAME, or (when USERNAME omitted) for the current user.

OPTIONS

TAG DESCRIPTION
-a ignore, for compatibility with other versions
-Z, --context print only the security context of the current user

-g, --group print only the effective group ID
-G, --groups print all group IDs
-n, --name print a name instead of a number, for -ugG
-r, --real print the real ID instead of the effective ID, with -ugG.

-u, --user print only the effective user ID.

EXAMPLES

EXAMPLE-1:

To print user name, UID of all the group to which the user belongs

$ id -a

output:
~$ id -a
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),111(libvirtd),112(lpadmin),113(sambashare)

EXAMPLE-2:

To print all different group IDs (effective, real and supplementary):

$ id -G

output:

$ id -G
1000 4 24 27 30 46 111 112 113

EXAMPLE-3:

To print the effective group ID

$ id -g

output:

id -g
1000

EXAMPLE-4:

To print the effective user ID

$ id -u

output:
 id -u
1000

EXAMPLE-5:

To print the specific user information:
id of ubuntu user

$ id ubuntu

output:
$ id ubuntu
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),111(libvirtd),112(lpadmin),113(sambashare)



Advertisements