• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

id Command Examples in Linux

by admin

The id command is used to display user ID (UID) and group ID (GID) information. Entering the command with no options displays information about the user who is currently logged in. You can also specify a user name as an option to display ID information about a specific user.

id command examples in Linux

Syntax

The syntax of the id command is:

# id [options] [user name]

id Command Examples

1. To print the current user ID:

# id 

2. To ge the all the identification information of the a user:

# id -a
# id -a mike 

3. To print only the security context of the user:

# id -Z
# id --context 

4. To print only the effective group ID:

# id -g
# id --group 

5. To print all the group IDs:

# id -G
# id --groups 

6. To print the name instead of number:

# id -n
# id --name 

7. To print the real ID instead of effective ID:

# id -r
# id --real 

8. To print only the effective ID:

# id -u
# id --user 

9. To get the help for ID command:

# id --help 

10. To get the version of the ID command:

# id --version

Filed Under: Linux

Some more articles you might also be interested in …

  1. “imuxsock lost # messages from pid # due to rate-limiting” – rsyslog rate-limiting in Linux
  2. “mlock failed: Cannot allocate memory” lvcreate command error in CentOS/RHEL 7
  3. How to (Correctly) Change the UID and GID of a user/group in Linux
  4. lvdisplay error: “Failed to create directory /var/lock/lvm. File-based locking initilisation failed.”
  5. sftp Command Examples in Linux
  6. How to Rebuild GRUB on MSDOS Partition Type in CentOS/RHEL/OEL 7
  7. How to Delete ASM Disk on Multipath Device in CentOS/RHEL
  8. Auditd Messages Are Filling Up /var/log/messages
  9. Shell/Bash Script to Find Prime Numbers in Linux
  10. How To Create/Remove and Mount a Stratis Filesystem in CentOS/RHEL 8

You May Also Like

Primary Sidebar

Recent Posts

  • What are /dev/zero and /dev/null files in Linux
  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright