how to use id command with its examples

  • About id : To print real and effective user and group IDs
  • It comes from “coreutils-8.4” package.

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 — 

Leave a Reply

Your email address will not be published. Required fields are marked *