CompTIA Linux+ (XK0-005) — Question 172
A systems administrator wants to list all local accounts in which the UID is greater than 500. Which of the following commands will give the correct output?
Answer options
- A. find /etc/passwd -size +500
- B. cut -d: -f1 /etc/passwd > 500
- C. awk -F: '$3 > 500 {print $1}' /etc/passwd
- D. sed '/UID/' /etc/passwd < 500
Correct answer: C
Explanation
The correct answer is C because the awk command correctly filters users by UID and prints the usernames. Option A is incorrect as it uses 'find' which is not suitable for this purpose. Option B is wrong because 'cut' does not filter based on UID values. Option D is invalid since 'sed' is not designed to filter UIDs in this manner.