We use analytics and advertising cookies to understand how the site is used and whether our ads on Facebook and Instagram work. They are set only if you accept. See our Privacy Policy for details.
Practice Bash and Linux interview questions on shell scripting, redirection and pipes, exit codes, processes and signals, permissions, and the command-line debugging interviewers actually ask about.
Answer a real Bash & Linux interview question before you browse the list. No signup needed.
nums = [1, 2, 2, 3]
for n in nums:
if n % 2 == 0:
nums.remove(n)
What is nums afterwards?
Practice in a session
10 questions from Bash & Linux, one after another, then your score and streak.
Quoting and word splitting, redirection and file descriptors, pipes and exit statuses, conditionals and loops, functions and variable scope, parameter expansion, and safe-script habits like set -euo pipefail and trap. DevOps, SRE and backend interviews add processes, signals, permissions and text processing with grep, sed, awk and find.
DevOps, SRE, platform, cloud and backend engineers most often, and increasingly data engineers and security engineers. Anyone who will be on call or who writes deployment and automation scripts should expect at least one shell or Linux troubleshooting question.
-e exits the script when a command fails, -u treats an unset variable as an error, and -o pipefail makes a pipeline fail if any command in it fails rather than only the last one. Together they turn silent failures into loud ones. Interviewers often follow up on the edge cases: -e does not fire inside an if condition or on the left side of && or ||.
Run it with bash -x (or set -x inside it) to trace each command after expansion, check exit codes with $?, quote every variable expansion to rule out word splitting, and run shellcheck, which catches most quoting and portability bugs before they reach production.
A full disk (df vs du, deleted-but-open files held by a process), a process that will not die (signals, zombies, kill -9 as a last resort), high load (top, load average vs CPU count, I/O wait), permission denied errors (ownership, mode bits, the execute bit on directories), and finding which process owns a port.