54 Linux · Shell questions from the System Administration bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.
Free to start: the 2-minute IT readiness check — six questions and a result.
B.print the first whitespace-delimited field of each line
C.count the number of lines in a file
D.find .log files modified more than 7 days ago
Answer + AI explanation with Pro
2. Which command will search text for lines matching a pattern?
Junior
A.grep
B.cut -d: -f1 /etc/passwd
C.sed
D.awk
Answer + AI explanation with Pro
3. Which statement is correct?
Junior
A.grep — count occurrences of each unique line
B.grep — process and extract text by fields/columns
C.grep — print the first whitespace-delimited field of each line
D.grep — search text for lines matching a pattern
Answer + AI explanation with Pro
4. What does awk do?
Junior
A.process and extract text by fields/columns
B.print the first whitespace-delimited field of each line
C.build and run commands from standard input
D.find .log files modified more than 7 days ago
Answer + AI explanation with Pro
5. Which command will process and extract text by fields/columns?
Junior
A.xargs
B.wc -l file
C.awk
D.awk '{print $1}'
Answer + AI explanation with Pro
6. Which statement is correct?
Junior
A.awk — extract the first colon-delimited field (usernames)
B.awk — process and extract text by fields/columns
C.awk — find .log files modified more than 7 days ago
D.awk — count the number of lines in a file
Answer + AI explanation with Pro
7. What does sed do?
Junior
A.search text for lines matching a pattern
B.perform stream text substitution/editing
C.count the number of lines in a file
D.process and extract text by fields/columns
Answer + AI explanation with Pro
8. Which command will perform stream text substitution/editing?
Junior
A.head -n 20 file
B.wc -l file
C.sed
D.find / -name '*.log' -mtime +7
Answer + AI explanation with Pro
9. Which statement is correct?
Junior
A.sed — perform stream text substitution/editing
B.sed — count the number of lines in a file
C.sed — replace all 'foo' with 'bar' in-place
D.sed — show the first 20 lines of a file
Answer + AI explanation with Pro
10. What is 2>&1?
Mid
A.the exit code of the last command (0 = success)
B.append output to a file instead of overwriting it
C.runs the next command only if the previous one succeeded
D.redirect stderr to wherever stdout currently points
Answer + AI explanation with Pro
11. Which term means: "redirect stderr to wherever stdout currently points"?
Mid
A.2>&1
B.$?
C.| (pipe)
D.trap
Answer + AI explanation with Pro
12. Which statement is correct?
Mid
A.2>&1 — redirect stderr to wherever stdout currently points
B.2>&1 — append output to a file instead of overwriting it
C.2>&1 — runs the next command only if the previous one succeeded
D.2>&1 — strict bash mode: exit on error, unset vars and pipe failures
Answer + AI explanation with Pro
13. What is $??
Junior
A.a bash builtin that runs code on a received signal (e.g. cleanup on EXIT)
B.append output to a file instead of overwriting it
C.the exit code of the last command (0 = success)
D.sends the stdout of one command to the stdin of the next
Answer + AI explanation with Pro
14. Which term means: "the exit code of the last command (0 = success)"?
Junior
A.$?
B.&& operator
C.| (pipe)
D.trap
Answer + AI explanation with Pro
15. Which statement is correct?
Junior
A.$? — strict bash mode: exit on error, unset vars and pipe failures
B.$? — redirect stderr to wherever stdout currently points
C.$? — the exit code of the last command (0 = success)
D.$? — runs the next command only if the previous one succeeded
Answer + AI explanation with Pro
16. What is >> operator?
Junior
A.the exit code of the last command (0 = success)
B.a bash builtin that runs code on a received signal (e.g. cleanup on EXIT)
C.sends the stdout of one command to the stdin of the next
D.append output to a file instead of overwriting it
Answer + AI explanation with Pro
17. Which term means: "append output to a file instead of overwriting it"?
Junior
A.>> operator
B.&& operator
C.set -euo pipefail
D.| (pipe)
Answer + AI explanation with Pro
18. Which statement is correct?
Junior
A.>> operator — redirect stderr to wherever stdout currently points
B.>> operator — the exit code of the last command (0 = success)
C.>> operator — a bash builtin that runs code on a received signal (e.g. cleanup on EXIT)
D.>> operator — append output to a file instead of overwriting it
Answer + AI explanation with Pro
19. What does cut -d: -f1 /etc/passwd do?
Junior
A.show the first 20 lines of a file
B.perform stream text substitution/editing
C.build and run commands from standard input
D.extract the first colon-delimited field (usernames)
Answer + AI explanation with Pro
20. Which command will extract the first colon-delimited field (usernames)?
Junior
A.find / -name '*.log' -mtime +7
B.wc -l file
C.cut -d: -f1 /etc/passwd
D.awk
Answer + AI explanation with Pro
21. Which statement is correct?
Junior
A.cut -d: -f1 /etc/passwd — show the first 20 lines of a file
B.cut -d: -f1 /etc/passwd — extract the first colon-delimited field (usernames)
C.cut -d: -f1 /etc/passwd — count the number of lines in a file
D.cut -d: -f1 /etc/passwd — perform stream text substitution/editing
Answer + AI explanation with Pro
22. What does sort | uniq -c do?
Junior
A.show the first 20 lines of a file
B.count occurrences of each unique line
C.extract the first colon-delimited field (usernames)
D.search text for lines matching a pattern
Answer + AI explanation with Pro
23. Which command will count occurrences of each unique line?
Junior
A.sed -i 's/foo/bar/g' file
B.wc -l file
C.sort | uniq -c
D.head -n 20 file
Answer + AI explanation with Pro
24. Which statement is correct?
Junior
A.sort | uniq -c — process and extract text by fields/columns
B.sort | uniq -c — count occurrences of each unique line
C.sort | uniq -c — count the number of lines in a file
D.sort | uniq -c — show the first 20 lines of a file
Answer + AI explanation with Pro
25. What does wc -l file do?
Junior
A.process and extract text by fields/columns
B.count the number of lines in a file
C.build and run commands from standard input
D.find .log files modified more than 7 days ago
Answer + AI explanation with Pro
26. Which command will count the number of lines in a file?
Junior
A.sort | uniq -c
B.head -n 20 file
C.wc -l file
D.cut -d: -f1 /etc/passwd
Answer + AI explanation with Pro
27. Which statement is correct?
Junior
A.wc -l file — process and extract text by fields/columns
B.wc -l file — find .log files modified more than 7 days ago
C.wc -l file — print the first whitespace-delimited field of each line
D.wc -l file — count the number of lines in a file
Answer + AI explanation with Pro
28. What does head -n 20 file do?
Junior
A.show the first 20 lines of a file
B.extract the first colon-delimited field (usernames)
C.search text for lines matching a pattern
D.build and run commands from standard input
Answer + AI explanation with Pro
29. Which command will show the first 20 lines of a file?
Junior
A.wc -l file
B.awk
C.head -n 20 file
D.sed
Answer + AI explanation with Pro
30. Which statement is correct?
Junior
A.head -n 20 file — extract the first colon-delimited field (usernames)
B.head -n 20 file — show the first 20 lines of a file
C.head -n 20 file — print the first whitespace-delimited field of each line
D.head -n 20 file — process and extract text by fields/columns
Answer + AI explanation with Pro
Showing 30 of 54 Linux · Shell questions — the full set, with answers, explanations and an AI tutor on every question, is inside.
Free to start
Start with a free readiness check
Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every Linux · Shell question come with Pro.