Linux Commands

Linux Id Command Tutorial

It is difficult for a new Linux user to monitor users or groups’ names with their Ids/Gids. In Linux distributions, an id is a command-line tool that is used to display the real and effective user’s Id and group’s Ids.

The real id is the one that owns the system; it points towards you if you’re an account owner. The effective id is similar to Real id but with some limitations.

You don’t need to download or install the id command utility, as it is a built-in tool in Linux-like systems.

Syntax of Id Command

id [Options]…[User Name]

Id Command

To display your own identity, type id in the terminal. It will display your id, primary group id, and supplementary groups ids if they exist.

$ id

Id Commands with Options

Here are some options to show the working of the id command utility.

Let’s get started:

1. To get a specific user’s id, use the “-u” option.

$ id -u warda

2. “-g” represents groups, so if you want to display a specific GID, use this option in the terminal:

$ id -g warda

3. To display all groups ids a user belongs to, the “-G” option will be used:

$ id -G warda

4. The “help” option is used to print help documents in the terminal for guidance and then exit.

$ id --help

Few other options are listed below that can be used when required:

Z:  To display security contest

-r:  To display real ids

-z:  To delimit entries through Null characters

-n:  To display name instead of the number

Now, let’s check how to print the name instead of the number using the -n option.

For example, if I want to print names of all groups the user belongs to instead of their ids, I will use the following command:

$ id –n -G warda

Here you can see, it prints names of all groups.

Similarly, you can use “-ng” for the real group name and “-nu” for the user’s name.

You can use the “-r” command with -u, -g, and -G options to display real id instead of effective id on the terminal.

For example, execute the following command to get real ids of the group, type:

$ id -r -g

As you can see, we can get real ids with and without the username command.

We will get the same results.

Let’s see another example:

$ id -r -G

And you can also get specific user’s details:

$ id warda


We have learned from this tutorial how to use the “Id” command for real and effective IDs. The “Id” command is used to print the user’s identity, specific group id, and all groups ids the user belongs to. We have also checked multiple options of the Id command and their functionalities.

About the author


Wardah Batool

I am a Software Engineer Graduate and Self Motivated Linux writer. I also love to read latest Linux books. Moreover, in my free time, i love to read books on Personal development.