One of the entry of /etc/passwd file is shown below:
user1:x:1111:2222:Example:/home/user1:/bin/bash
Which among the following will print userid and home dir in the following pattern “user1:/home/user1”
user1:x:1111:2222:Example:/home/user1:/bin/bash
A. awk `{print $1 ":" $6}` /etc/passwd
B. awk `{print $1 ":" $7}` /etc/passwd
C. awk `{print $2 ":" $6}` /etc/passwd
D. awk `{print $2 ":" $7}` /etc/passwd
Answer: Option A
Related Questions on Linux
What command is used to count the total number of lines, words, and characters contained in a file?
A. countw
B. wcount
C. wc
D. count p
E. None of the above
What command is used with vi editor to delete a single character?
A. x
B. y
C. a
D. z
E. None of the above
Join The Discussion