1. What does grep do? Junior A. search text for lines matching a pattern 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 Reveal the answer + AI explanation — free account
2. Which command will search text for lines matching a pattern? Junior A. grep B. cut -d: -f1 /etc/passwd C. sed D. awk Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
5. Which command will process and extract text by fields/columns? Junior A. xargs B. wc -l file C. awk D. awk '{print $1}' Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
11. Which term means: "redirect stderr to wherever stdout currently points"? Mid A. 2>&1 B. $? C. | (pipe) D. trap Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
14. Which term means: "the exit code of the last command (0 = success)"? Junior A. $? B. && operator C. | (pipe) D. trap Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
17. Which term means: "append output to a file instead of overwriting it"? Junior A. >> operator B. && operator C. set -euo pipefail D. | (pipe) Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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) Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free account
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 Reveal the answer + AI explanation — free accountShowing 30 of 54 Linux · Shell questions — the full set, with answers, explanations and an AI tutor on every question, is inside.