Q. One of the entry of /etc/passwd file is shown below: user1:x:1111:2222:McqMate:/home/user1:/bin/bash Which among the following will print userid and home dir in the following pattern “user1:/home/user1” (Solved)

1. awk `{print $1 “:” $6}` /etc/passwd

2. awk `{print $1 “:” $7}` /etc/passwd

3. awk `{print $2 “:” $6}` /etc/passwd

4. awk `{print $2 “:” $7}` /etc/passwd

  • a. awk `{print $1 “:” $6}` /etc/passwd
Subscribe Now

Get All Updates & News