← 返回命令列表

Linux command

id 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Show current user info

id

Show info for user

id [username]

Show only user ID

id -u

Show only group ID

id -g

Show all group IDs

id -G

Show names instead of numbers

id -n -u

说明

id displays user and group identity information. It shows UID, GID, and supplementary groups for users. The command is useful for verifying permissions and group memberships. It can query any user or the current user by default.

参数

-u, --user
Print user ID only.
-g, --group
Print primary group ID.
-G, --groups
Print all group IDs.
-n, --name
Print names instead of IDs.
-r, --real
Print real ID.
--help
Display help information.

FAQ

What is the id command used for?

id displays user and group identity information. It shows UID, GID, and supplementary groups for users. The command is useful for verifying permissions and group memberships. It can query any user or the current user by default.

How do I run a basic id example?

Run `id` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -u, --user do in id?

Print user ID only.