Display User and Group Information

LinuxBeginner
Practice Now

Introduction

In this challenge, you will identify the account currently logged in to the Linux environment and inspect the account's group memberships. These tasks are common when checking permissions, troubleshooting access issues, or confirming which user a shell session is running as.

Display Your Current User Identity

In this step, you will use a Linux command to display your current user identity.

Note: This is a Challenge rather than a guided lab. Challenges are a different type of resource provided by LabEx, designed for assessment and testing your skills rather than teaching. You'll need to apply your existing knowledge to complete the tasks independently.

Tasks

  • Display your current user identity.

Requirement

  • Use the appropriate Linux command to display your current user identity.

Example

When you complete this step, your terminal should print only the current username. The example below shows the expected output format, not the command you should type. Your username might be different depending on the environment.

labex

Terminal showing user identity

Display User and Group Information

In this step, you will use a Linux command to display detailed user and group information.

Tasks

  • Display user and group information.

Requirement

  • Use the appropriate Linux command to display detailed user and group information, including fields such as uid, gid, and groups.

Example

When you complete this step, your terminal should show detailed identity information similar to the following. The exact numeric IDs and group names in your environment may differ.

uid=1000(labex) gid=1000(labex) groups=1000(labex),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lpadmin),126(sambashare)

Terminal user group info

Summary

Congratulations! You have successfully completed the "Display User and Group Information" challenge. By using whoami and id, you learned how to check which user is currently logged in and how to inspect the account's uid, primary gid, and supplementary groups. These checks are useful when verifying permissions, troubleshooting access problems, and confirming the execution context of scripts or services. To explore these commands further, you can review their manual pages with man whoami and man id.

✨ Check Solution and Practice✨ Check Solution and Practice