Linux Foundation Certified System Administrator (LFCS) — Question 72
What command will generate a list of user names from /etc/passwd along with their login shell?
Answer options
- A. column -s : 1,7 /etc/passwd
- B. chop -c 1,7 /etc/passwd
- C. colrm 1,7 /etc/passwd
- D. cut -d: -f1,7 /etc/passwd
Correct answer: D
Explanation
The command 'cut -d: -f1,7 /etc/passwd' is the correct choice as it uses the colon as a delimiter to extract the first and seventh fields, which correspond to the username and login shell, respectively. The other options either use incorrect commands or parameters that do not extract the necessary fields from the /etc/passwd file.