InterviewStack.io LogoInterviewStack.io

Shell Scripting and Automation Questions

Automating tasks with the command line: Bash and shell scripting, pipes and redirection, text processing, and writing custom tooling and monitoring scripts to glue systems together. Covers the scripting fundamentals infrastructure and platform engineers use daily, including automation-oriented use of general-purpose scripting. Distinct from application programming in its throwaway-to-durable tooling mindset.

HardSystem Design
22 practiced

Design a stateful health aggregator that computes service-level health from multiple instance-level reports. Requirements: support quorum rules (e.g., service is healthy if at least M of N instances report healthy), tolerate delayed or missing reports, minimize flapping, and expose real-time and historical views. Sketch components, data model, and algorithms for state transitions including hysteresis.

EasyTechnical
26 practiced

Implement an exponential backoff generator in Python called get_backoff(attempt:int, base:float=0.5, cap:float=60.0, jitter:bool=True) -> float that returns the sleep time in seconds for a given retry attempt. The function should respect the cap, support optional full jitter, and be deterministic given a seed when jitter is enabled. Document complexity and any assumptions.

HardTechnical
22 practiced

You are on-call and a production service suffers a cascading failure causing high latency and increased error rates. Draft a concise runbook (steps an on-call engineer should follow) and propose an automated mitigation script that implements a circuit breaker and traffic shifting to a healthy region. Include safety checks and a rollback path in your automation plan.

MediumTechnical
18 practiced

Write a monitoring script that inspects disk usage per filesystem and sends an alert when usage exceeds an adjustable threshold. The script should deduplicate alerts for the same filesystem to avoid alert spamming, support a cooldown period, and be robust to transient spikes. Provide code or pseudocode and describe persistence of alert state across restarts.

MediumTechnical
18 practiced

Write a parser function in Python that accepts log lines with timestamps in multiple common formats (example: '2021-03-15T13:45:30Z', 'Mar 15 13:45:30', '03/15/2021 13:45:30') and normalizes them to ISO8601 with timezone. The parser should handle missing year by inferring from context and handle ambiguous month/day ordering optionally via a parameter.

Unlock Full Question Bank

Get access to all 34 Shell Scripting and Automation interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.