id Linux Commands
What is Linux id Command?
Explanation
id COMMAND:id command prints the effective(current) and real userid(UID)s and groupid(GID)s.
SYNTAX :
id [options]
OPTIONS:
-a |
Reports user name, use ID and all the groups to which the user belongs. |
-G |
Output all real and effective group IDs,using the format "%un". |
-g |
Output only the effective group IDs,using the format "%un". |
-u |
Output only the effective user Id,using the format "%un". |
EXAMPLE:
-
id -a
Output:
uid=501(username) gid=501(username) groups=48(apache),
501(username)
Prints real and current group IDs.
id -G
Output:
501 48
Prints in the format of "%un"
# id
Output:
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),
4(adm),6(disk),10(wheel) context=user_u:system_r:unconfined_t
The above example display the rootuser uid, gid, groups and context.