Linux & SRE Interview Questions: Advanced DevOps Guide
Master Linux and SRE interview questions with real-world scenarios, debugging guides, and production incident analysis.
20+ years shipping production code across the stack, with years spent interviewing engineers. Everything here is grounded in real deployments.
- ✓Basic knowledge of Linux command line and system administration.
- ✓Familiarity with DevOps concepts and tools like Docker, Kubernetes.
- ✓Understanding of monitoring and alerting fundamentals.
- Master Linux system internals: processes, memory, filesystems, and networking.
- Understand SRE principles: SLIs, SLOs, error budgets, and incident management.
- Practice debugging production issues using strace, perf, and systemd.
- Be ready to explain trade-offs in reliability vs. feature velocity.
- Know common interview questions on load balancing, logging, and monitoring.
Think of Linux as the engine of a car and SRE as the pit crew. Linux interview questions check if you know how the engine works—how to start it, fix it, and tune it. SRE questions check if you can keep the car running smoothly during a race, handle crashes, and make sure the driver (user) has a great experience. You need both skills to be a top DevOps engineer.
Linux and Site Reliability Engineering (SRE) are the backbone of modern DevOps. In an interview, you'll be tested not just on commands but on deep understanding of system internals, troubleshooting methodologies, and reliability principles. This guide covers advanced topics like process management, memory analysis, filesystem debugging, networking, and SRE concepts such as SLIs, SLOs, error budgets, and incident response. We'll walk through real interview questions with solutions, production incidents, and debugging cheat sheets. By the end, you'll be ready to ace any Linux or SRE interview and demonstrate your ability to keep large-scale systems reliable.
1. Linux Process Management
Process management is a core Linux interview topic. You need to understand process states, signals, and how to troubleshoot. Common questions: 'How do you find a process using the most memory?' or 'What is a zombie process and how do you fix it?' Use ps, top, htop, and /proc filesystem. For example, to list top memory consumers: ps aux --sort=-%mem | head. A zombie process is a child that has terminated but its parent hasn't reaped it. You can kill the parent or send SIGCHLD. In an interview, explain the process lifecycle: fork, exec, wait. Also discuss signals like SIGTERM, SIGKILL, and SIGSTOP. Practical tip: Use strace to trace system calls of a process. Example: strace -p 1234 -e trace=network to see network calls.
dmesg for I/O errors.2. Memory Management and Analysis
Memory issues are common in production. Interviewers ask: 'How do you check memory usage?' or 'What is swap and when is it used?' Use free -m, vmstat, and /proc/meminfo. Understand the difference between virtual and resident memory. A memory leak can be detected by monitoring top over time. Use pmap -x PID to see memory mapping. In an interview, explain the OOM killer: when memory is exhausted, the kernel kills a process based on oom_score. You can adjust oom_score_adj to protect critical services. Example: echo -1000 > /proc/PID/oom_score_adj. Also discuss swap: swap is used when physical memory is full. High swap usage indicates memory pressure. Use swapon --show to see swap usage.
oom_score_adj to protect critical services from being killed.3. Filesystem and Disk Management
Filesystem questions test your knowledge of disk usage, inodes, and mount points. Common: 'How do you find large files?' or 'What is an inode?' Use df -h for disk usage, du -sh * for directory sizes, and ls -i for inode numbers. To find files older than 30 days: find / -type f -mtime +30. Understand filesystem types: ext4, XFS, Btrfs. In an interview, discuss the difference between hard links and soft links. Hard links share the same inode; soft links are pointers. Also discuss lsof to find open files. Example: lsof | grep deleted shows files that are deleted but still held open, causing disk space not to be freed.
4. Networking Fundamentals
Networking is critical for SRE. Interviewers ask: 'How do you check listening ports?' or 'How do you troubleshoot connectivity issues?' Use ss -tlnp to see listening TCP ports, netstat (deprecated but still used), and tcpdump for packet capture. Understand the OSI model and TCP/IP stack. Common tools: ping, traceroute, mtr, nslookup, dig. For performance, use iperf to test bandwidth. In an interview, explain how to check for packet loss: netstat -s | grep -i loss. Also discuss socket states: LISTEN, ESTABLISHED, TIME_WAIT. Many TIME_WAIT sockets can indicate connection pooling issues. Example: ss -s shows socket statistics.
net.ipv4.tcp_tw_reuse and tcp_tw_recycle (deprecated).5. Systemd and Service Management
Modern Linux uses systemd. Interviewers ask: 'How do you create a systemd service?' or 'How do you view logs?' Use systemctl to manage services: systemctl start|stop|restart|status. Logs are viewed with journalctl. Example: journalctl -u nginx -f to follow logs. Understand unit files: location /etc/systemd/system/. A simple service file includes [Unit], [Service], [Install] sections. In an interview, explain the difference between Type=simple and Type=forking. Also discuss dependencies: After=network.target. For debugging, use systemd-analyze blame to see boot time.
RestartSec to avoid rapid restart loops.6. SRE Principles: SLIs, SLOs, and Error Budgets
SRE interviews focus on reliability metrics. SLI (Service Level Indicator) is a measurement, e.g., latency. SLO (Service Level Objective) is a target, e.g., 99.9% of requests under 200ms. Error budget is the allowed failure: 1 - SLO. Interviewers ask: 'How do you define an SLO?' or 'What happens when error budget is exhausted?' Explain that error budget is a tool to balance reliability and feature velocity. When budget is exhausted, development slows down to focus on reliability. Use monitoring tools like Prometheus to track SLIs. Example: latency SLI = p99 latency. In an interview, discuss trade-offs: tighter SLO means less room for error but higher reliability.
7. Incident Management and Postmortems
SREs handle incidents. Interviewers ask: 'Describe your incident response process.' or 'What is a blameless postmortem?' Explain the stages: detection, response, mitigation, resolution, follow-up. Use tools like PagerDuty for alerting. A blameless postmortem focuses on system failures, not people. Example: 'The deployment caused a config error; we added automated validation.' In an interview, emphasize communication: status updates, escalation paths. Also discuss runbooks: documented procedures for common incidents. Use incident.io or similar.
8. Monitoring and Alerting
Monitoring is key. Interviewers ask: 'What metrics do you monitor?' or 'How do you set up alerts?' Use Prometheus for metrics, Grafana for dashboards, and Alertmanager for alerts. Understand the four golden signals: latency, traffic, errors, saturation. Example: alert on p99 latency > 500ms for 5 minutes. In an interview, discuss alert fatigue: too many alerts cause desensitization. Use proper thresholds and aggregation. Also discuss logging: ELK stack (Elasticsearch, Logstash, Kibana) or Loki. Structured logging helps in debugging.
The Silent Memory Leak That Took Down a Microservice
- Always monitor memory usage trends, not just spikes.
- Use tools like
top,ps, and/proc/meminfoto identify leaks. - Implement proper resource cleanup in code.
- Set up alerts on OOMKill events.
- Use load testing to simulate long-running scenarios.
top or htop to find the process. Use perf top to see kernel/hot functions. Check for infinite loops or high context switching.dmesg | grep -i oom for OOM killer logs. Use free -m and vmstat to see memory usage. Identify process with ps aux --sort=-%mem.iostat -x 1 to see I/O stats. Identify processes with iotop. Check for swap usage with swapon --show.ping, traceroute, and mtr to diagnose. Check netstat -s for errors. Use tcpdump to capture packets.journalctl -u servicename. Use strace -p PID to see system calls. Verify port listening with ss -tlnp.kill -SIGCHLD <parent_pid>If that fails, kill parent process| File | Command / Code | Purpose |
|---|---|---|
| process_monitor.sh | ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu | head -10 | 1. Linux Process Management |
| memory_check.sh | echo "=== Memory Usage ===" | 2. Memory Management and Analysis |
| disk_usage.sh | echo "=== Disk Usage ===" | 3. Filesystem and Disk Management |
| network_check.sh | echo "=== Listening Ports ===" | 4. Networking Fundamentals |
| myapp.service | [Unit] | 5. Systemd and Service Management |
| slo_calculation.py | slo = 0.999 # 99.9% | 6. SRE Principles |
| incident_response.sh | echo "Incident response steps:" | 7. Incident Management and Postmortems |
| prometheus_alert.yml | groups: | 8. Monitoring and Alerting |
Key takeaways
Common mistakes to avoid
3 patternsUsing `netstat` instead of `ss`
Ignoring OOM killer logs
Setting too many alerts
Interview Questions on This Topic
Explain the Linux boot process from BIOS to systemd.
Frequently Asked Questions
20+ years shipping production code across the stack, with years spent interviewing engineers. Everything here is grounded in real deployments.
That's DevOps Interview. Mark it forged?
3 min read · try the examples if you haven't