id
user managementLinux/Unix
The id command is one of the most frequently used commands in Linux/Unix-like operating systems. id Display user identity information
Quick Reference
Command Name:
id
Category:
user management
Platform:
Linux/Unix
Basic Usage:
id [options] [arguments]
Common Use Cases
Syntax
id [options] [username]
Options
Option | Description |
---|---|
-u, --user |
Print only the effective user ID |
-g, --group |
Print only the effective group ID |
-G, --groups |
Print all group IDs |
-n, --name |
Print a name instead of a number (with -ugG) |
-r, --real |
Print the real ID instead of the effective ID (with -ugG) |
-z, --zero |
Delimit entries with NULL characters, not whitespace |
-Z, --context |
Print only the security context (SELinux) |
--help |
Display help information and exit |
--version |
Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the id
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
id