Beginner · 5 min · practise every command in the built-in terminal

User Information Commands

whoami — Current user

whoami

id — Detailed user info

id                     # Your UID, GID, and groups
id username            # Info for specific user

Output:

uid=1000(student) gid=1000(student) groups=1000(student),27(sudo)

groups — Show groups

groups                 # Your groups
groups username        # Groups for specific user

who and w — Who is logged in

who                    # Who is logged in
w                      # Who is logged in + what they're doing
last                   # Login history
lastlog                # Last login for all users

/etc/passwd — User database

cat /etc/passwd

Format: username:password:UID:GID:comment:home:shell

student:x:1000:1000::/home/student:/bin/bash

/etc/group — Group database

cat /etc/group

Format: groupname:password:GID:members

Practice tasks

  1. Display your user ID information
  2. See what groups you belong to
  3. Check who is currently logged in
  4. View the /etc/passwd user database

Commands in this lesson

Users & Groups