🎓 A1Learner
🔍
0 of 50 lessons completed

Who Are You

An account is a named login on the machine. whoami prints the name of the account you are using now.

Your account name

whoami prints one name. The name differs on every machine.

$ whoami

The numbers behind the name

id prints the numbers behind the name. The numbers differ on every machine.

$ id

Your groups

groups prints the group names for this account. This account has one group.

$ groups

Who is signed in

who prints one line for each account that is signed in. On this machine it prints nothing.

$ who

Example

$ whoami
$ id
$ groups

Key points

  • Use whoami to print your account name.
  • Use id to print the numbers behind your account.
  • Use groups to print your group names.
  • Use who to print the accounts that are signed in now.
  • In short, whoami names the account, and id shows its numbers.

In this example, whoami prints the account name. The name is alex. id prints the numbers next. The user number is 1000, and the group number is 1000. groups prints the group names last. This account has one group, named alex.

Note

The who list changes as accounts sign in and out.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What does the whoami command print?