https://drive.google.com/file/d/1ORD8tMMJ8bWN5RaLojE9m9-S7HmOYMqF/view?usp=sharing

1. Viewing Current User and Session Info

Explanation

These commands help you identify who you are, who is logged in, and your user/group IDs.

Commands

whoami          # Shows current username
who am i        # Shows your login session (terminal, time, etc.)
w               # Lists all logged-in users and their activities
id              # Shows your UID, GID, and groups
id username     # Shows UID/GID/groups for a specific user

Examples

whoami
# Output: zybi

id zybi
# Output: uid=1001(zybi) gid=1001(zybi) groups=1001(zybi),1002(developer)

Lab Steps

  1. Run all four commands:

    whoami
    who am i
    w
    id
    
    

2. Switching Users with su

Explanation

Commands

su username        # Switch to user (non-login shell)
su - username      # Switch with full login environment
su                 # Switch to root (non-login)
su -               # Switch to root (login shell)
exit               # Return to previous user

Examples

su - root          # Become root with root's environment
pwd                # Now in /root
exit               # Back to original user