Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux id Command

Linux id Command

Linux Command Reference Linux Command Reference

The Linux id command displays a user's ID and the IDs of the groups they belong to.

id shows the real and effective IDs of a user and their groups. If the two IDs are the same, only the real ID is shown. If only a username is given, the ID of the current user is shown.

This command displays the user's UID (User ID), GID (Group ID), and all group IDs the user is a member of.

Syntax

id [-gGnru][--help][--version][用户名称]

Parameter Description:

Example

Display current user information:

# id //显示当前用户ID

uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=root:system_r:unconfined_t

Display a user's group ID:

# id -g

0

Display all group IDs:

# id -G

0 1 2 3 4 5 6 10

Display information for a specified user

# id hnlinux

Linux Command Reference Linux Command Reference