FactorPad
Faster Learning Tutorials

Linux id command summary with examples

id allows you to show user and group information.
  1. Purpose - Learn what id is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with id.
  4. A tip - Finish off with one more insight.
Paul Alan Davis, CFA, November 8, 2016
Updated: August 5, 2018
In this tutorial, 77 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Next

~/ home  / tech  / linux essentials  / id command


The Linux id command

Beginner

Learn to find user and group information at the Linux command line.

Video Tutorial

Linux id command summary with examples (3:32)

Videos can also be accessed from the YouTube Playlist.

Video Script

The Command and Why You Need It

Our seventy-seventh word, or command to memorize is id from our category Users.

id allows you to show user and group information.

Recall from the previous video (tutorial) on chown, we set file ownership to user and groups. We also saw a text file that stores group information (using cat /etc/group). Now we'll get a quick view of our current memberships.

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The id command has 10 options, and an argument optionally is the username.

Like most commands, help is available with double-dash --help. The -G option shows Group IDs (GID) and -u shows User IDs (UID), so yes, all groups and users are given an identification number.

So why is id an important command? Well, it may help to see which groups you're in so you can identify what responsibilities come with your membership. And now you know how to do that.

Demonstration

Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go. Let's start by with an id -G for paul.

$ id -G paul 1001

And there's the group number, but let's make it more descriptive with an -n at the end.

$ id -Gn paul paul

And that looks better. Again, this could be a long list if for example I had multiple different groups and they had long names.

Then on the user side, id -u for the User ID (UID).

$ id -u paul 1001

And the -n for name.

$ id -un paul paul

And last, the default behavior, of simply id shows all the info in one place, which may get messy if you're part of a lot of groups.

$ id uid=1001(paul) gid=1001(paul) groups=1001(paul)

A Final Tip

Okay now you know how to use id. And you know the syntax for commands, options and arguments.

One last tip about the id command. So we saw who we are with the whoami command in video (tutorial) 13 and now with id we can find our User ID (UID) and group membership (GID). Here are two others we won't afford a whole video to, first is the who command which shows you who is logged in currently and second is w which shows you what they're doing. Interesting.

Okay, thanks for visiting today. I hope this was a helpful introduction to the id command.


Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:


What's Next?

Be part of our growing family on YouTube. Subscribe here.

  • For the Outline to all 100 tutorials, click Outline.
  • To go back to the chown command, hit Back.
  • To learn to log in as a different user with the su command, click Next.

Outline Back Next

~/ home  / tech  / linux essentials  / id command



 
 
Keywords:
linux id command
find uid
id command
linux user id
linux group id
get uid linux
show uid linux
get gid linux
show gid linux
linux user management
linux show user
linux show groups
man id
user id examples
linux remove user from group
linux user group