exam questions

Exam LFCS All Questions

View all questions & answers for the LFCS exam

Exam LFCS topic 1 question 79 discussion

Actual exam question from Linux Foundation's LFCS
Question #: 79
Topic #: 1
[All LFCS Questions]

Which of the following commands prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file?

  • A. fmt -f 1,4 /etc/passwd
  • B. split -c 1,4 /etc/passwd
  • C. cut -d : -f 1,4 /etc/passwd
  • D. paste -f 1,4 /etc/passwd
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
9866666
5 months, 1 week ago
Selected Answer: C
The correct answer is C. cut -d : -f 1,4 /etc/passwd Explanation: cut is designed for extracting specific fields (columns) from delimited text files. -d : specifies the colon ":" as the delimiter. -f 1,4 selects the first (username) and fourth (primary group ID) fields. Here's why the other options are incorrect: fmt: Primarily used for formatting text and doesn't have options for field extraction. split: Divides files into smaller pieces based on size or number of lines, not fields. paste: Used to merge lines of files, not extract specific columns.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...