While auditing user accounts on a production server, you need a quick command that lists only those entries in /etc/passwd whose numeric user ID (UID) is 1000 or higher (the typical range for regular interactive users). The command must print just the login name and its UID in the form username:UID, one match per line. Which awk one-liner accomplishes this goal?
The password file is colon-delimited, so awk must set the input field separator with -F':' . In /etc/passwd the third field ($3) is the UID. The correct one-liner therefore specifies the colon separator, tests whether $3 is 1000 or greater, and prints the first and third fields joined by a literal colon. Commands that omit -F':' treat the entire line as a single field, those that compare $4 examine the primary GID instead of the UID, and those that print $0 output the whole record rather than the required username:UID pair.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the -F':' option in awk do?
Open an interactive chat with Bash
What is the significance of the $3 field in /etc/passwd?
Open an interactive chat with Bash
Why is the colon (:) the delimiter in /etc/passwd?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access