Linux & Bash interview questions

42 real Linux & Bash questions from the MLOps & Integration bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Linux & Bash free