Attacks and Exploits
A tester needs only the first field of each line in a colon-delimited file, such as usernames in /etc/passwd. Which Bash command extracts it?
Show the answer
Correct answerC. cut -d: -f1 users.txt
AWhy not this: Counts lines in the file; it extracts no field data.
BWhy not this: Copies standard input to the file; it does not select fields.
CWhy this is right: Uses a colon delimiter and prints only the first field of each line.
DWhy not this: Sorts lines and removes duplicates but leaves each full line intact.
cut with -d: sets the colon as delimiter and -f1 selects the first field. sort -u only orders lines and removes duplicates; it does not select a field.