Linux Search Pattern Interview Preparation Guide

Sharpen your Search Pattern interview expertise with our handpicked 45 questions. Each question is designed to test and expand your Search Pattern expertise. Suitable for all experience levels, these questions will help you prepare thoroughly. Secure the free PDF to access all 45 questions and guarantee your preparation for your Search Pattern interview. This guide is crucial for enhancing your readiness and self-assurance.
Tweet Share WhatsApp

45 Search Pattern Questions and Answers:

1 :: Indicate the right option to search for anything not a letter or number:
a) grep '^[a-zA-Z0-9]'
b) grep '[^a-zA-Z0-9]'
c) grep '[a-zA-Z0-9]'
d) None of the above in Search Pattern

b) grep '[^a-zA-Z0-9]'
Download PDFRead All Search Pattern Questions

2 :: One of the entry of /etc/passwd file is shown below:
user1:x:1111:2222:google:/home/user1:/bin/bash
Which among the following will print userid and home dir in the following pattern "user1:/home/user1"?
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

a) awk `{print $1 ":" $6}` /etc/passwd

3 :: How do you remove duplicate lines from the file foo using uniq?
a) sort foo | uniq -u
b) sort -u foo | uniq -d
c) sort foo | uniq -c
d) sort foo | uniq -I

a) sort foo | uniq -u

4 :: What is the command that can print lines of first file matching with second file?
a) printline
b) cmp
c) com
d) comm

d) comm

5 :: Which character to use to escape meaning of special characters in search operations?
a) []
b) ^
c) .
d)

d)
Download PDFRead All Search Pattern Questions

6 :: who | cut -d " " -f1.
What is the ouput if the who command displays like this user1 tty 0 1234?
a) user1
b) user1 tty 0 1234
c) tty
d) tty 0 1234

a) user1

7 :: Which one is used to select only one copy of the repeated lines?
a) uniq -u
b) uniq -d
c) uniq -c
d) uniq -I

a) uniq -u

8 :: Indicate the right option to search for BOB, Bob, BOb or BoB?
a) grep -i Bob files
b) grep 'B[oO][bB]' files
c) grep '[BOB]' files
d) grep -v 'Bob' files

b) grep 'B[oO][bB]' files

9 :: How can you search for blank line in a file?
a) $ grep " " file
b) $ grep "^$" file
c) $ grep [" "] file
d) $ grep [^$] file

d) $ grep [^$] file

10 :: Which option of grep displays the line number as well?
a) -v
b) -l
c) -n
d) -E

c) -n
Download PDFRead All Search Pattern Questions