Linux Troubleshooting Interview Questions: Triage Order, Commands and the Pushback

Branko Petric
Branko Petric

- 18 min read

The short answer

Linux troubleshooting interview questions test your triage order, not your command list. Find what is actually wrong before changing anything: df and du before rm, vmstat and iostat before blaming the CPU, the kernel log before adding swap, namei before chmod. Then say what you would not do, and hold that position under pushback.

Most lists of Linux interview questions are command glossaries: what does df do, what is the difference between kill and kill -9, how do you find a process by port. Those come up in screening calls. In a real DevOps or SRE loop the question is usually a broken server. The interviewer describes the symptom, a teammate in the story suggests a fast fix, and you have to say what you would run first, what you would not do, and why.

Below are six common Linux scenario based interview questions for DevOps and SRE roles. Each one has the prompt, the commands in the order you would run them with realistic output, the pushback to expect, and a weak answer next to a strong one. For the overall shape of a DevOps loop, see how to pass a DevOps interview.

What these questions are really testing

Three things, in every scenario below:

  1. Triage order. Do you look before you change? Every scenario has a destructive shortcut on offer: rm -rf, a reboot, chmod 777, a bigger box. The interviewer wants to hear what you check before you touch anything.
  2. Do you know what the numbers mean? Load average is not CPU usage. df and du can disagree for a good reason. "Permission denied" names a user and a path. Reading the output correctly is most of the answer.
  3. Do you fix the cause, not just the symptom? Freeing space is the first half. Fixing the log rotation that filled the disk is the second half, and it is the half that separates a mid-level answer from a senior one.

A weak answer names a command. A strong one says what the command will show and what you will decide from it.

Scenario 1: "Disk is full. Just rm -rf /var/log"

The prompt: "A web server is throwing 'No space left on device' and the app is down. df shows / at 100%. A teammate says just run rm -rf on /var/log to free space fast. What do you do, and why?"

Say you will not delete blind, then show that finding the culprit takes about a minute.

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1   50G   50G     0 100% /
/dev/nvme1n1     200G   61G  140G  31% /data

That confirms which filesystem is full. Now find what is using it. The -x flag keeps du on one filesystem, so /data and /proc do not pollute the result:

sudo du -xh --max-depth=1 / 2>/dev/null | sort -h | tail -5
1.9G    /opt
2.4G    /usr
3.8G    /var
4.1G    /home
13G     /

This is the interesting case: df says 50G used, du can only find 13G. When the two disagree like this, the usual cause is a file that was deleted while a process still holds it open. The directory entry is gone, so du cannot see it, but the blocks stay allocated until the last file descriptor closes. lsof +L1 lists open files with a link count below 1, which means deleted but still open:

sudo lsof +L1
COMMAND  PID    USER   FD   TYPE DEVICE    SIZE/OFF NLINK   NODE NAME
java    2214 appuser    7w   REG  259,1 39728238592     0 524301 /var/log/app/app.log (deleted)

There is the missing space: about 37G held by the app's log, which someone already deleted with rm. This is exactly why the teammate's plan is wrong. An rm -rf /var/log would delete more open log files the same way and free nothing while the app keeps them open. You reclaim the space by truncating through the process's file descriptor, or by restarting the process so it closes the handle:

sudo truncate -s 0 /proc/2214/fd/7

If du had matched df, the next checks are the common fillers: the systemd journal and missing rotation.

journalctl --disk-usage
sudo journalctl --vacuum-size=500M
sudo logrotate -d /etc/logrotate.d/app   # dry run: shows what rotation would do

journalctl --vacuum-size removes archived journal files safely, which rm inside /var/log/journal does not do cleanly. One more check catches people out: a filesystem can be "full" with free blocks if it has run out of inodes, usually from millions of tiny files in a cache or session directory.

df -i /
Filesystem      Inodes   IUsed IFree IUse% Mounted on
/dev/nvme0n1p1 3276800 3276800     0  100% /

If IUse% is 100, df -h can show space left and writes still fail with the same error.

The pushback: "Every second of downtime costs money. Why are you running du when you could clear /var/log right now?"

Weak answer Strong answer
"Fair, I will clear the logs and look at it after." "du takes under a minute. Blind rm may not free anything if the app holds the files open, and it destroys the logs that explain this outage."
"I would just grow the volume, disk is cheap." "Growing the volume may be right later, but if a log has no rotation it fills the bigger disk too. I find the cause, then decide on size."
"Reboot it, that clears things up." "A reboot does free space held by deleted-but-open files, but so does restarting one process, without the downtime of the whole box. It frees nothing on disk that is actually in use."

The rest of the argument, what to reclaim first, how to fix rotation so it does not come back, and what alert would have caught it at 80%, is what the challenge scores you on.

Practice this one: /challenges/linux-disk-full-basics

Scenario 2: "The server is running slow and load average is 12"

The prompt: "Users say the app is slow. You SSH in and load average is 12 on a 4-core box. A teammate says the CPU is maxed and wants to add more cores. What do you check first?"

This is the classic high load average interview question, and the trap is in the teammate's assumption. On Linux, load average counts processes that are runnable (state R) and processes in uninterruptible sleep (state D), which is usually a process waiting on disk or network storage. A load of 12 can mean the CPUs are saturated, or it can mean eight processes are stuck waiting for a slow disk while the CPUs sit idle.

Start with the shape of the load and the core count:

uptime
nproc
 14:32:01 up 9 days,  3:12,  2 users,  load average: 12.31, 11.87, 9.02
4

The three numbers are the 1, 5 and 15 minute averages. Rising from 9 to 12 means it is getting worse, not recovering. Now split CPU pressure from IO pressure with vmstat 1:

vmstat 1 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1 11      0 412340  80212 9821044    0    0  5120 48210 2210 3890  4  3 12 81  0
 0 12      0 409872  80216 9824120    0    0  4980 51200 2180 3812  3  3 10 84  0

Read it column by column. r (runnable) is 0 or 1, far below the 4 cores. b (blocked in uninterruptible sleep) is 11 to 12. us and sy are single digits, and wa (time waiting on IO) is above 80. The CPU is not the bottleneck. More cores would change nothing. Confirm which device and which processes:

iostat -x 1 3
Device       r/s      w/s    rkB/s    wkB/s  r_await  w_await  aqu-sz  %util
nvme0n1    42.00  1210.00  5120.00 48210.00     3.10    94.20   38.40  100.00

(Columns trimmed.) A write latency (w_await) of 94 ms and a deep queue (aqu-sz) say the disk cannot keep up. Note that %util alone is misleading on SSD and NVMe devices, which serve many requests in parallel, so lean on the await and queue numbers. Then find who is stuck:

ps -eo state,pid,user,comm | awk '$1=="D"'
sudo pidstat -d 1 5

ps lists the D-state processes counted in the load, and pidstat -d (or iotop) shows which process is writing. A typical finding is a backup job, a log flood or a batch export hammering the same volume as the database.

If vmstat had shown r well above the core count with us near 100 and wa near 0, it really is CPU, and top or pidstat -u 1 names the process. If si and so were non-zero, the box is swapping, which is a memory problem that looks like an IO problem.

The pushback: "Load is 12 and we have 4 cores. That is three times overloaded. More CPU is the obvious fix."

Weak answer Strong answer
"Yes, load above the core count means we need more CPU." "Load on Linux includes processes blocked on IO. vmstat shows r at 1 and wa at 80, so the CPUs are mostly idle and waiting on the disk."
"I would restart the app to clear the load." "The app is a victim here. The D-state processes and pidstat -d point at the writer, and that is what I deal with."

There is no challenge for this one yet. The free Linux performance guide walks the same sweep in more depth, including /proc/pressure and strace.

Scenario 3: "It keeps getting OOM-killed. Add a huge swapfile?"

The prompt: "A latency-sensitive service keeps getting OOM-killed on its VM, and a teammate says just add 16GB of swap and crank vm.swappiness so the kernel stops killing it. What do you do, and why?"

First confirm what killed it and which limit it hit. The kernel logs every OOM kill:

sudo journalctl -k --since "-1 day" | grep -iE "oom-kill|killed process"
kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/api.service,task=java,pid=2314,uid=998
kernel: Out of memory: Killed process 2314 (java) total-vm:9876544kB, anon-rss:7340032kB, file-rss:0kB, shmem-rss:0kB, UID:998 pgtables:15112kB oom_score_adj:0

The constraint field is the first thing to read. CONSTRAINT_NONE with global_oom means the whole VM ran out of memory. CONSTRAINT_MEMCG means the process hit a cgroup limit, a systemd MemoryMax= or a container limit, while the host may have had plenty free. Those are different problems, and only the first one is even related to host swap. For a cgroup kill, check the limit and its counters:

systemctl show -p MemoryMax api.service
cat /sys/fs/cgroup/system.slice/api.service/memory.events
MemoryMax=8589934592
low 0
high 0
max 312
oom 4
oom_kill 4

Then work out which of three things you have, because each one has a different fix: a leak (RSS climbs steadily over hours until it dies), a load spike (memory jumps with traffic), or a real working set that is simply larger than the RAM you gave it. Memory metrics over time answer that, and heap or allocation profiling confirms a leak.

The core point about swap: for a latency-sensitive service, paging hot memory to disk is far slower than RAM. A big swapfile with high swappiness turns a fast kill and restart into a box that stays up but misses every latency target, and it hides the warning signal while doing so. Better early warning is memory pressure, which the kernel exposes directly:

cat /proc/pressure/memory
some avg10=12.40 avg60=8.15 avg300=3.02 total=91822341
full avg10=4.10 avg60=2.33 avg300=0.88 total=30122456

Non-zero full means all non-idle tasks were stalled on memory at the same time. Alert on that trend, before the kill.

The pushback: "The OOM kill is the outage. Anything that stops the kill is a win, right?"

Weak answer Strong answer
"Right, swap is extra memory, so more swap means fewer kills." "Swap trades a clean restart for a slow, thrashing service that still misses its SLOs. I would rather know why it outgrows its memory."
"Disable the OOM killer for that process." "Then the whole VM can hang under pressure instead of shedding one process. I set an explicit limit and oom_score_adj deliberately instead."
"Just double the instance size." "Maybe, if it is a real working set. If it is a leak, a bigger box only delays the next kill. I measure first."

The rest of the argument, how to size the limit, where swap is still reasonable, and what to alert on, is what the challenge scores you on.

Practice this one: /challenges/linux-oom-swap-tuning

Scenario 4: "Permission denied. Just chmod -R 777"

The prompt: "A deploy to a Linux VM fails with 'Permission denied' when the app tries to write to its data directory. A teammate says just run chmod -R 777 on the whole app directory so permissions can never break a deploy again. What do you do, and why?"

"Permission denied" always means a specific user could not do a specific thing on a specific path. Find all three. First, the user the service runs as:

systemctl show -p User api.service
id appuser
User=appuser
uid=998(appuser) gid=998(appuser) groups=998(appuser)

Then the ownership and mode of every directory on the path. namei -l walks it component by component, which catches a parent directory that blocks traversal even when the target looks fine:

namei -l /srv/app/data/uploads
f: /srv/app/data/uploads
drwxr-xr-x root    root    /
drwxr-xr-x root    root    srv
drwxr-xr-x appuser appuser app
drwxr-xr-x appuser appuser data
drwxr-xr-x root    root    uploads

There is the mismatch: uploads is owned by root with mode 755, so appuser can read it but not write to it. The usual cause is a deploy step that ran as root and created the directory. The fix is precise:

sudo chown -R appuser:appuser /srv/app/data
sudo chmod 750 /srv/app/data /srv/app/data/uploads
sudo -u appuser touch /srv/app/data/uploads/.write-test && echo ok

Then fix the deploy so it creates files as the service user, or ends with a chown, otherwise the next release brings the error back.

If the mode bits and owner are clearly right and writes still fail, check mandatory access control before anything else. On RHEL-family systems, getenforce and ls -Z show whether SELinux is enforcing and what context the directory has, and sudo ausearch -m avc -ts recent shows the denial. The fix there is the correct file context, not looser mode bits.

The pushback: "It is an internal box, nobody else has a shell on it. 777 takes ten seconds and the deploy ships."

Weak answer Strong answer
"True, it is internal, so 777 is acceptable for now." "777 means any process on the box can rewrite the app's code and data, so one exploited service becomes a full app compromise. chown takes the same ten seconds."
"Then run the app as root so it never hits this." "That turns any bug in the app into root on the host. The app needs write on one directory, not on everything."
"We fixed it last month and it broke again, so 777 is the durable fix." "It broke again because the deploy still writes as root. That step is the real bug. Fix it there and it stays fixed."

The rest of the argument, which modes to use, how to share a directory between two users with group ownership, and what 777 breaks, is what the challenge scores you on.

Practice this one: /challenges/chmod-777-to-fix-it

Scenario 5: "One bad sysctl. Just SSH in and fix it by hand"

The prompt: "Prod is degraded because of one wrong kernel/sysctl value in /etc, and a teammate says just SSH into the three boxes and fix the file by hand now, we'll put it in Ansible later. What do you do, and why?"

A realistic version: the boxes are dropping new connections and the kernel log says why.

sudo journalctl -k | grep conntrack
sysctl net.netfilter.nf_conntrack_max net.netfilter.nf_conntrack_count
kernel: nf_conntrack: nf_conntrack: table full, dropping packet
net.netfilter.nf_conntrack_max = 65536
net.netfilter.nf_conntrack_count = 65536

The value is wrong. The question is where you fix it. Two details make the hand-edit plan worse than it sounds. Editing a file in /etc/sysctl.d/ does not change the running kernel until you run sysctl --system or reboot. And sysctl -w changes the running kernel but not the file, so it is lost on reboot. Neither one survives the next Ansible run, which writes the file back to whatever the repo says and can reload it.

The strong answer puts the fix where the source of truth is. With the ansible.posix.sysctl module, the task writes the file and applies the live value in one step:

- name: Raise conntrack table size
  ansible.posix.sysctl:
    name: net.netfilter.nf_conntrack_max
    value: "262144"
    sysctl_file: /etc/sysctl.d/90-conntrack.conf
    reload: true
ansible-playbook site.yml --limit web --tags sysctl --check --diff
ansible-playbook site.yml --limit web --tags sysctl
ansible web -m command -a "sysctl net.netfilter.nf_conntrack_max"

A check-mode run, the real run and a verification across three hosts is a few minutes, not much slower than three SSH sessions. If the bleeding truly cannot wait that long, sysctl -w on each box is an acceptable stopgap, said out loud as temporary, with the repo change landing in the same incident rather than "later".

The pushback: "It is one line. Are you seriously running a whole Ansible play for one line during an incident?"

Weak answer Strong answer
"Fair, I will edit the files now and open a ticket to codify it." "The next converge or node replacement silently reverts a hand edit, and the outage comes back with no obvious cause. One targeted play is nearly as fast."
"Disable Ansible on those three boxes so my fix sticks." "That freezes them as snowflakes that miss every future change. I put the value in the repo so every node, including new ones, gets it."

The rest of the argument, when a live stopgap is justified, and how to confirm every node converged and catch the next manual edit, is what the challenge scores you on.

Practice this one: /challenges/linux-hotfix-outside-config-mgmt

Scenario 6: "502 after a deploy. Tweak the nginx config?"

The prompt: "Right after a deploy, your site returns 502 Bad Gateway from nginx. A teammate says it is nginx, let us tweak the nginx config and reload. Where do you actually look first, and why?"

A 502 means nginx reached for the upstream and got no valid response. nginx is the messenger. Its error log usually says exactly what went wrong:

sudo tail -n 3 /var/log/nginx/error.log
2026/11/25 14:02:11 [error] 812#812: *4417 connect() failed (111: Connection refused) while connecting to upstream, client: 203.0.113.7, server: example.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "example.com"

Connection refused on 127.0.0.1:8080 means nothing is listening there. Check what is:

sudo ss -ltnp
State   Recv-Q  Send-Q  Local Address:Port  Peer Address:Port  Process
LISTEN  0       511           0.0.0.0:80         0.0.0.0:*      users:(("nginx",pid=812,fd=6))
LISTEN  0       128         127.0.0.1:22         0.0.0.0:*      users:(("sshd",pid=640,fd=3))

Nothing on 8080. The app is down or listening somewhere else. Ask systemd and read the app's own logs:

systemctl status api.service
sudo journalctl -u api.service -n 50 --no-pager

The usual findings after a deploy: a missing environment variable, a failed migration, a crash on startup, or a new default port. Once the app is up, test it directly, going around nginx:

curl -sS -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8080/healthz

Only if the app is healthy and nginx still returns 502 do you look at proxy_pass. Other error log messages point elsewhere: upstream prematurely closed connection usually means the app crashed mid-request, and upstream timed out is a 504, not a 502.

The pushback: "Just restart nginx and the app a few times, one of them will clear it."

Weak answer Strong answer
"Worth a try, restarts often fix 502s." "nginx was fine before the deploy. Restarting it does nothing for an app that fails on startup. The app log says why it will not start."
"Roll back immediately and investigate tomorrow." "Rollback may be right if I cannot fix it fast, but I read the log first, or the next deploy ships the same break."

Practice this one: /challenges/nginx-502-after-deploy

A triage order you can reuse

Every scenario above follows the same order, and saying it out loud in the interview is half the answer:

  1. Do not change anything yet. Say it first, especially when a teammate in the story is pushing a fast fix.
  2. Confirm the symptom with one command. df -h, uptime, the OOM line in journalctl -k, the exact error and path.
  3. Find the specific cause. du and lsof +L1, vmstat 1 and iostat -x, the OOM constraint, namei -l, ss -ltnp and the app log.
  4. Fix the narrowest thing. Truncate one file, stop one writer, change one owner, raise one value in the repo.
  5. Fix why it happened. Log rotation, a memory limit, the deploy step, config management, a health check.
  6. Add the signal that would have caught it. Disk and inode alerts, memory pressure, drift detection.

The logging guide, file permissions guide, processes guide and systemd guide cover the commands above in more depth. For more scenarios across tools, see scenario-based DevOps interview questions, and the Linux interview questions hub collects the Linux scenario questions in one place.

Practicing under pushback

Knowing lsof +L1 is the easy part. In the interview, someone argues for the fast fix and watches whether you fold. A general chatbot makes up an answer on the spot. DevOps Ledger grades you against an answer key written before you started. Each scenario above with a Practice link is a challenge where you defend your call against that kind of pushback and see which arguments held up.

FAQ

What are the most common Linux troubleshooting interview questions?

Disk full, a server running slow with high load average, OOM kills, permission denied, a service that will not start, and a 502 or connection refused after a deploy. For SRE roles, expect a follow-up on how you would stop it happening again: rotation, limits, alerts or config management.

Why does df show the disk full when du shows free space?

Usually a deleted file is still held open by a running process. du walks directory entries and cannot see it, but df reports allocated blocks. lsof +L1 lists those files. Truncate them through /proc/<pid>/fd/<n> or restart the process to release the space.

How do you answer a high load average interview question?

Say that Linux load average counts runnable processes and processes in uninterruptible sleep, usually waiting on IO. Compare load to nproc, then use vmstat 1: high r and us means CPU, high b and wa means IO. Confirm with iostat -x and ps for D-state processes.

What should you never do when a Linux server breaks in an interview scenario?

Never take a destructive or broad action before you have looked: rm -rf on a log directory, a reboot to "clear it", chmod -R 777, running the app as root, or a hand edit on a config-managed box. Interviewers include these shortcuts on purpose to see whether you push back.

Are Linux interview questions for SRE different from DevOps ones?

The scenarios overlap heavily. SRE loops tend to push harder on measurement and prevention: reading vmstat and pressure stall information correctly, alerting before the failure, and limits that keep one process from taking down a host.

Practice these scenarios

Free guides to read next

Practice defending your decisions

DevOps Ledger is a scenario-based DevOps and SRE interview practice platform: you pick a real production incident, defend your decision in a chat against a senior-engineer AI that pushes back, and get scored against an answer key written before you started.

One payment. 12 months of access. No subscription, nothing renews.

Get full access - $19