Linux for Developers Course
Linux for Developers
/
Intermediate

id Command

Definition

A command that prints the real and effective user IDs (UID) and group IDs (GID) for a specified user.

Explain Like I'm New

A much more detailed version of `whoami` and `groups` combined. It prints the actual mathematical numbers the Kernel uses to identify you.

Real World Example

Linux doesn't actually understand the name 'bob'. It only understands that Bob is User Number 1001. Typing `id` shows `uid=1001(bob) gid=1001(bob) groups=1001(bob),27(sudo)`. This is vital for Docker permissions.

Common Use Cases

  • •Debugging Docker volume permissions
  • •Advanced troubleshooting

Interview Questions

basic

  • What is the UID (User ID) of the `root` superuser?

intermediate

  • Why is the `id` command critical when mounting Host volumes into Docker containers?

Flash Cards

Question

Root UID?

Click to reveal answer
Answer

Zero (0). The Linux kernel grants absolute power to whichever user has UID 0, regardless of what their name is.

Question

Why critical for Docker?

Click to reveal answer
Answer

Because a Docker container might run its app as UID 1000. If your laptop user is UID 1001, and you mount a folder, the container won't be able to write to your folder due to a UID mismatch.