Linux & Bash interview questions

42 Linux & Bash questions from the MLOps & Integration 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.

Take the free IT readiness check

or take a mock interview set up for this area

1. What does grep -r 'ERROR' /var/log do?

Junior
  1. A.recursively search files under /var/log for lines containing ERROR
  2. B.make the deploy.sh script executable
  3. C.edit the file in place, replacing every dev with prod
  4. D.list all processes and filter for those running python

Answer + AI explanation with Pro

2. Which command will recursively search files under /var/log for lines containing ERROR?

Junior
  1. A.grep -r 'ERROR' /var/log
  2. B.curl -fsS https://api/health
  3. C.tail -f /var/log/app.log
  4. D.awk '{print $1}' access.log

Answer + AI explanation with Pro

3. Which statement is correct?

Junior
  1. A.grep -r 'ERROR' /var/log — recursively search files under /var/log for lines containing ERROR
  2. B.grep -r 'ERROR' /var/log — edit the file in place, replacing every dev with prod
  3. C.grep -r 'ERROR' /var/log — make a Bash script exit on error, unset variables and failed pipe stages
  4. D.grep -r 'ERROR' /var/log — make the deploy.sh script executable

Answer + AI explanation with Pro

4. What does chmod +x deploy.sh do?

Junior
  1. A.make the deploy.sh script executable
  2. B.edit the file in place, replacing every dev with prod
  3. C.print the first whitespace-delimited field of each line
  4. D.recursively search files under /var/log for lines containing ERROR

Answer + AI explanation with Pro

5. Which command will make the deploy.sh script executable?

Junior
  1. A.ps aux | grep python
  2. B.chmod +x deploy.sh
  3. C.xargs -n1 -P4
  4. D.curl -fsS https://api/health

Answer + AI explanation with Pro

6. Which statement is correct?

Junior
  1. A.chmod +x deploy.sh — print the first whitespace-delimited field of each line
  2. B.chmod +x deploy.sh — edit the file in place, replacing every dev with prod
  3. C.chmod +x deploy.sh — make a Bash script exit on error, unset variables and failed pipe stages
  4. D.chmod +x deploy.sh — make the deploy.sh script executable

Answer + AI explanation with Pro

7. What does ps aux | grep python do?

Junior
  1. A.make a Bash script exit on error, unset variables and failed pipe stages
  2. B.stream new lines appended to the log file in real time
  3. C.edit the file in place, replacing every dev with prod
  4. D.list all processes and filter for those running python

Answer + AI explanation with Pro

8. Which command will list all processes and filter for those running python?

Junior
  1. A.sed -i 's/dev/prod/g' config.ini
  2. B.ps aux | grep python
  3. C.curl -fsS https://api/health
  4. D.tail -f /var/log/app.log

Answer + AI explanation with Pro

9. Which statement is correct?

Junior
  1. A.ps aux | grep python — make a silent HTTP request that fails the script on a non-2xx status
  2. B.ps aux | grep python — stream new lines appended to the log file in real time
  3. C.ps aux | grep python — list all processes and filter for those running python
  4. D.ps aux | grep python — recursively search files under /var/log for lines containing ERROR

Answer + AI explanation with Pro

10. What does tail -f /var/log/app.log do?

Junior
  1. A.make a silent HTTP request that fails the script on a non-2xx status
  2. B.edit the file in place, replacing every dev with prod
  3. C.list all processes and filter for those running python
  4. D.stream new lines appended to the log file in real time

Answer + AI explanation with Pro

11. Which command will stream new lines appended to the log file in real time?

Junior
  1. A.tail -f /var/log/app.log
  2. B.chmod +x deploy.sh
  3. C.set -euo pipefail
  4. D.curl -fsS https://api/health

Answer + AI explanation with Pro

12. Which statement is correct?

Junior
  1. A.tail -f /var/log/app.log — make a silent HTTP request that fails the script on a non-2xx status
  2. B.tail -f /var/log/app.log — print the first whitespace-delimited field of each line
  3. C.tail -f /var/log/app.log — edit the file in place, replacing every dev with prod
  4. D.tail -f /var/log/app.log — stream new lines appended to the log file in real time

Answer + AI explanation with Pro

13. What does awk '{print $1}' access.log do?

Mid
  1. A.make the deploy.sh script executable
  2. B.list all processes and filter for those running python
  3. C.print the first whitespace-delimited field of each line
  4. D.edit the file in place, replacing every dev with prod

Answer + AI explanation with Pro

14. Which command will print the first whitespace-delimited field of each line?

Mid
  1. A.awk '{print $1}' access.log
  2. B.sed -i 's/dev/prod/g' config.ini
  3. C.ps aux | grep python
  4. D.chmod +x deploy.sh

Answer + AI explanation with Pro

15. Which statement is correct?

Mid
  1. A.awk '{print $1}' access.log — print the first whitespace-delimited field of each line
  2. B.awk '{print $1}' access.log — list all processes and filter for those running python
  3. C.awk '{print $1}' access.log — make a Bash script exit on error, unset variables and failed pipe stages
  4. D.awk '{print $1}' access.log — stream new lines appended to the log file in real time

Answer + AI explanation with Pro

16. What does sed -i 's/dev/prod/g' config.ini do?

Mid
  1. A.recursively search files under /var/log for lines containing ERROR
  2. B.run a command in parallel with up to four processes, one argument each
  3. C.edit the file in place, replacing every dev with prod
  4. D.make a silent HTTP request that fails the script on a non-2xx status

Answer + AI explanation with Pro

17. Which command will edit the file in place, replacing every dev with prod?

Mid
  1. A.sed -i 's/dev/prod/g' config.ini
  2. B.curl -fsS https://api/health
  3. C.set -euo pipefail
  4. D.awk '{print $1}' access.log

Answer + AI explanation with Pro

18. Which statement is correct?

Mid
  1. A.sed -i 's/dev/prod/g' config.ini — list all processes and filter for those running python
  2. B.sed -i 's/dev/prod/g' config.ini — edit the file in place, replacing every dev with prod
  3. C.sed -i 's/dev/prod/g' config.ini — make a Bash script exit on error, unset variables and failed pipe stages
  4. D.sed -i 's/dev/prod/g' config.ini — stream new lines appended to the log file in real time

Answer + AI explanation with Pro

19. What does xargs -n1 -P4 do?

Mid
  1. A.recursively search files under /var/log for lines containing ERROR
  2. B.run a command in parallel with up to four processes, one argument each
  3. C.make a silent HTTP request that fails the script on a non-2xx status
  4. D.stream new lines appended to the log file in real time

Answer + AI explanation with Pro

20. Which command will run a command in parallel with up to four processes, one argument each?

Mid
  1. A.xargs -n1 -P4
  2. B.ps aux | grep python
  3. C.sed -i 's/dev/prod/g' config.ini
  4. D.set -euo pipefail

Answer + AI explanation with Pro

21. Which statement is correct?

Mid
  1. A.xargs -n1 -P4 — make the deploy.sh script executable
  2. B.xargs -n1 -P4 — run a command in parallel with up to four processes, one argument each
  3. C.xargs -n1 -P4 — edit the file in place, replacing every dev with prod
  4. D.xargs -n1 -P4 — make a silent HTTP request that fails the script on a non-2xx status

Answer + AI explanation with Pro

22. What does curl -fsS https://api/health do?

Mid
  1. A.make a Bash script exit on error, unset variables and failed pipe stages
  2. B.list all processes and filter for those running python
  3. C.make a silent HTTP request that fails the script on a non-2xx status
  4. D.print the first whitespace-delimited field of each line

Answer + AI explanation with Pro

23. Which command will make a silent HTTP request that fails the script on a non-2xx status?

Mid
  1. A.grep -r 'ERROR' /var/log
  2. B.chmod +x deploy.sh
  3. C.curl -fsS https://api/health
  4. D.sed -i 's/dev/prod/g' config.ini

Answer + AI explanation with Pro

24. Which statement is correct?

Mid
  1. A.curl -fsS https://api/health — run a command in parallel with up to four processes, one argument each
  2. B.curl -fsS https://api/health — make a silent HTTP request that fails the script on a non-2xx status
  3. C.curl -fsS https://api/health — print the first whitespace-delimited field of each line
  4. D.curl -fsS https://api/health — list all processes and filter for those running python

Answer + AI explanation with Pro

25. What does set -euo pipefail do?

Senior
  1. A.print the first whitespace-delimited field of each line
  2. B.recursively search files under /var/log for lines containing ERROR
  3. C.make the deploy.sh script executable
  4. D.make a Bash script exit on error, unset variables and failed pipe stages

Answer + AI explanation with Pro

26. Which command will make a Bash script exit on error, unset variables and failed pipe stages?

Senior
  1. A.grep -r 'ERROR' /var/log
  2. B.set -euo pipefail
  3. C.curl -fsS https://api/health
  4. D.tail -f /var/log/app.log

Answer + AI explanation with Pro

27. Which statement is correct?

Senior
  1. A.set -euo pipefail — recursively search files under /var/log for lines containing ERROR
  2. B.set -euo pipefail — print the first whitespace-delimited field of each line
  3. C.set -euo pipefail — stream new lines appended to the log file in real time
  4. D.set -euo pipefail — make a Bash script exit on error, unset variables and failed pipe stages

Answer + AI explanation with Pro

28. What is Exit code?

Junior
  1. A.the | operator that connects one command's stdout to the next command's stdin
  2. B.the time-based scheduler that runs commands on a recurring schedule defined in a crontab
  3. C.a service definition that systemd uses to start, supervise and restart long-running daemons
  4. D.the integer a process returns where 0 means success and non-zero signals a specific failure

Answer + AI explanation with Pro

29. Which term means: "the integer a process returns where 0 means success and non-zero signals a specific failure"?

Junior
  1. A.systemd unit
  2. B.cron
  3. C.SIGTERM
  4. D.Exit code

Answer + AI explanation with Pro

30. Which statement is correct?

Junior
  1. A.Exit code — the graceful-shutdown signal a container or process receives before being forcefully killed with SIGKILL
  2. B.Exit code — the | operator that connects one command's stdout to the next command's stdin
  3. C.Exit code — a service definition that systemd uses to start, supervise and restart long-running daemons
  4. D.Exit code — the integer a process returns where 0 means success and non-zero signals a specific failure

Answer + AI explanation with Pro

Showing 30 of 42 Linux & Bash 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 & Bash question come with Pro.

Take the free IT readiness check

or take a mock interview set up for this area

24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers