Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the command to display the contents of the /etc/passwd file.
Linux CLI
cat [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using /etc/shadow instead of /etc/passwd, which requires root permission to view.
Trying to view /etc/group or /etc/hosts which are different files.
✗ Incorrect
The /etc/passwd file contains user account information and can be viewed with 'cat /etc/passwd'.
2fill in blank
mediumComplete the command to safely view the /etc/shadow file with root privileges.
Linux CLI
sudo [1] /etc/shadow Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ls' which lists files but does not show contents.
Using 'echo' which prints text but not file contents.
Using 'touch' which creates or updates files.
✗ Incorrect
The 'cat' command displays file contents. 'sudo cat /etc/shadow' shows the shadow file with root rights.
3fill in blank
hardFix the error in the command to list users from /etc/passwd by extracting the first field (username).
Linux CLI
cut -d: -f[1] /etc/passwd Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing field 2 or 3 which contain other data like user ID or group ID.
Using wrong delimiter or field number.
✗ Incorrect
Usernames are in the first field of /etc/passwd, separated by colons, so use '-f1'.
4fill in blank
hardFill both blanks to create a command that counts the number of user accounts in /etc/passwd.
Linux CLI
cat /etc/passwd | [1] -d: -f1 | [2] -l
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'sort' or 'uniq' instead of counting lines.
Not extracting the correct field before counting.
✗ Incorrect
Use 'cut' to extract usernames and 'wc -l' to count lines (users).
5fill in blank
hardFill both blanks to create a command that lists usernames from /etc/passwd who have a user ID greater than 1000.
Linux CLI
awk -F: '[1] $3 [2] 1000 print $1' /etc/passwd
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting parentheses causing syntax errors.
Using '<' instead of '>' which filters wrong users.
Not printing the first field ($1) which is the username.
✗ Incorrect
The awk condition needs parentheses around '$3 > 1000' to filter user IDs greater than 1000 and print usernames.