Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to display the current logged-in username.
Linux CLI
[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'id' instead of 'whoami' to get only the username.
Using 'pwd' which shows current directory, not username.
✗ Incorrect
The whoami command shows the current logged-in username.
2fill in blank
mediumComplete the code to display the user ID and group ID of the current user.
Linux CLI
[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'whoami' which only shows username, not IDs.
Using 'groups' which shows only group names.
✗ Incorrect
The id command shows user ID (UID), group ID (GID), and groups of the current user.
3fill in blank
hardFix the error in the command to show only the user ID number.
Linux CLI
id [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-g' which shows group ID instead of user ID.
Using '-n' which is for name, not numeric ID.
✗ Incorrect
The -u option with id shows only the user ID number.
4fill in blank
hardFill both blanks to display the primary group name of the current user.
Linux CLI
id [1] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
-G which shows all group IDs, not primary group.Mixing up user ID options with group options.
✗ Incorrect
Combining -n and -g shows only the primary group name.
5fill in blank
hardFill all three blanks to create a dictionary in Python showing username and user ID using shell commands.
Linux CLI
user_info = { [1]: "$(whoami)", [2]: "$(id [3])" } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
"gid" instead of "uid" for user ID.Forgetting quotes around dictionary keys.
✗ Incorrect
This creates a Python dictionary with keys username and uid. The -u option gets the user ID number.