← Interview Prep

Linux Fundamentals — SRE Interview Q&A

The core Linux SRE/DevOps screen: processes, threads, signals, /proc/meminfo, load average, page faults, file descriptors, ss backlog, namespaces & cgroups, containers vs VMs.

The bread-and-butter Linux screen for an SRE/DevOps role: fast, correct answers about processes, memory, the network stack, and how you'd actually debug a box. Grouped the way interviewers ask them.

Quick-fire operations questions

QuestionAnswer
Monitoring/debug utilities you reach fortop/htop/atop, vmstat, iostat, ss, lsof, dstat, sar, strace, tcpdump. Be ready to go deep on one (e.g. atop records historical per-process CPU/mem/disk).
How much RAM (total/used/free)free -m, vmstat, cat /proc/meminfo, top/htop/atop.
How many CPU coresnproc, lscpu, cat /proc/cpuinfo, getconf _NPROCESSORS_ONLN; in top press 1.
Files opened by a processlsof -p <pid> or ls -l /proc/<pid>/fd.
Free space on a filesystemdf -h (blocks), df -i (inodes), stat -f <path>.
Time since last bootuptime, w, who -b, cat /proc/uptime.
Test a remote portnc -vz <host> <port>, telnet <host> <port>, curl -v host:port, nmap -p <port> <host>.
Check for hardware problemsdmesg (ring buffer), logs under /var/log/ (kern.log, messages, syslog); smartctl for disks, mcelog/EDAC for RAM/CPU.
One-shot process listps ax; start time with ps axo lstart,args.
Debug the network stacktcpdump (capture), plus ss, ip, ethtool.
OSI order of ip, ethernet, tcp, icmp, http, dnsethernet (L2) → ip, icmp (L3) → tcp, udp (L4) → http, dns (L7). DNS rides UDP and TCP.
TCP port range0–65535 (16-bit).
TCP connections per HTTP request/responseOne (HTTP/1.1 keep-alive reuses it for many requests).
What ping doesTests reachability of a destination IP via ICMP Echo Request/Reply.
What each command does — with example output

free -m — memory in MB. Look at available (not free): that's what you can allocate without swapping.

              total   used   free   shared  buff/cache  available
Mem:          15884   3921    412       88       11550       11421
Swap:          2047      0    2047

nproc / lscpu — logical CPU count / full topology (sockets, cores, threads, NUMA).

$ nproc
8
$ lscpu | grep -E 'Socket|Core|Thread|CPU\(s\):'
CPU(s):              8
Thread(s) per core:  2
Core(s) per socket:  4
Socket(s):           1

df -h / df -i — blocks / inodes. A full df -h with an idle df -i = a space problem; the reverse = inode exhaustion.

$ df -h /       Size  Used Avail Use% Mounted on
                 40G   34G  6.0G  86% /
$ df -i /      Inodes  IUsed  IFree IUse% Mounted on
               2.6M    148K   2.4M    6% /

ss -ltnp — listening TCP sockets with the owning process. For a LISTEN socket, Recv-Q = current accept-queue depth, Send-Q = the backlog (max).

State   Recv-Q  Send-Q  Local Address:Port   Process
LISTEN  0       511     0.0.0.0:80           users:(("nginx",pid=1201,fd=6))
LISTEN  0       128     0.0.0.0:22           users:(("sshd",pid=812,fd=3))

lsof -p <pid> / ls /proc/<pid>/fd — every open file/socket a process holds (count them against its limit).

$ ls /proc/1201/fd | wc -l
42
$ lsof -p 1201 | awk '{print $5}' | sort | uniq -c | sort -rn | head -3
     28 IPv4      # sockets
      9 REG       # regular files
      3 CHR

uptime — time since boot + the 1/5/15-min load average (compare to core count).

$ uptime
 14:22:07 up 37 days,  4:12,  2 users,  load average: 1.20, 0.98, 0.71

ps axo lstart,args — process list with exact start time (spot a process that restarted, or has been up suspiciously long).

$ ps -eo pid,ppid,stat,etime,comm | head -3
  PID  PPID STAT     ELAPSED COMMAND
    1     0 Ss     37-04:12  systemd
 1201     1 Ss     37-04:10  nginx

dmesg -T | tail — kernel ring buffer (human timestamps): OOM kills, disk resets, link flaps, hardware errors.

[Tue Aug 25 03:11:20 2026] Out of memory: Killed process 8842 (java) ...
[Tue Aug 25 03:11:20 2026] oom_reaper: reaped process 8842 (java) ...

Reading /proc/meminfo

free is just a friendly view of this file. The fields interviewers probe:

FieldMeaning
MemFreeTruly unused RAM. Usually small — Linux deliberately uses free RAM for cache.
MemAvailableThe number that matters: estimate of allocatable memory without swapping (free + reclaimable cache). Use this, not MemFree, to judge pressure.
BuffersKernel block-I/O buffers (filesystem metadata) — small.
CachedPage cache: file contents held in RAM; reclaimable under pressure.
Active/Inactive (anon/file)Anon = allocated process memory (heap/stack, needs swap to evict). File = page cache (can just be dropped). Inactive = eviction candidates.
Dirty / WritebackFile data modified in cache but not yet on disk (Dirty), or being flushed now (Writeback).
MlockedMemory pinned via mlock() so it can't be swapped (keys, latency-sensitive maps).
Slab / SReclaimableKernel object caches (dentries/inodes); the reclaimable part frees under pressure.
SwapTotal/SwapFreeSwap capacity/free. Heavy swap use = memory pressure.
Committed_AS vs CommitLimitTotal memory promised to processes vs the overcommit ceiling — approaching the limit risks allocation failures / the OOM killer.
HugePages_*, AnonHugePagesLarge (2 MiB/1 GiB) pages — fewer TLB misses for databases/JVMs.

CPU & load average

Load average (the 1/5/15-minute numbers in uptime) is the average number of tasks runnable or waiting over that window. Compare it to core count: load 8 on 8 cores ≈ fully busy.

Processes, threads & syscalls

Process states (the ps STAT letters)

The first letter is the state; the rest are modifiers. ps -eo pid,stat,comm / ps aux show them.

CodeStateMeaning
RRunning / runnableOn a CPU, or on a run queue ready to run.
SInterruptible sleepWaiting for an event; wakeable by a signal. The common idle state.
DUninterruptible sleepBlocked in a syscall (usually I/O); signals don't wake it — not even SIGKILL. Persistent D = stuck I/O (hung NFS, bad disk).
ZZombie (<defunct>)Exited, waiting for the parent to wait(). Holds only a PID slot; fix the parent, not the zombie.
TStoppedJob-control stop (SIGSTOP/Ctrl-Z) or a ptrace stop.
tTracedStopped by a debugger (ptrace).
IIdle kernel threadAn idle D-like kernel thread (not counted in load average).
XDeadAbout to be reaped (rarely seen).
ModifierMeaning
<High priority (negative nice).
NLow priority (positive nice).
sSession leader.
lMulti-threaded.
+In the foreground process group.
LHas pages locked in memory (mlock).

So Ssl = interruptible-sleep, session-leader, multithreaded (a typical daemon); R+ = running in the foreground. The two that page you: D (stuck I/O) and Z (parent not reaping) — both resist kill -9 for different reasons; see Linux Troubleshooting and Processes.

Signals

SignalNumMeaning
SIGHUP1Terminal hangup; by convention "reload config" for daemons.
SIGINT2Ctrl-C.
SIGKILL9Force kill — uncatchable, no cleanup.
SIGTERM15Default kill; graceful shutdown (catchable).
SIGSTOP/SIGCONT19/18Pause / resume (STOP is uncatchable).
SIGUSR1/SIGUSR210/12User-defined — apps assign their own meaning (e.g. re-open logs).

A signal is an asynchronous notification to a process — a basic IPC mechanism.

Page faults: minor vs major

Files, fds & the deleted flag

A file descriptor is a per-process handle to an open file/socket/pipe. When lsof -p <pid> shows a path marked (deleted), the directory entry was removed but a process still holds the fd open — so the inode and its disk blocks aren't freed yet. Classic cause: bad log rotation — the file is unlinked but the daemon keeps writing to the old fd, so df stays full while du can't find the space. Fix: signal the app to re-open (copytruncate or postrotate). See also Linux Basics.

Sockets: ss -lna and the backlog

For a TCP socket in LISTEN, the two queue columns aren't bytes:

ColumnFor a LISTEN socket
Recv-QNumber of established connections waiting to be accept()ed (the current accept-queue depth).
Send-QThe backlog — max size of that accept queue (listen() backlog, capped by net.core.somaxconn).

When the accept queue is full (app too slow to accept()), new connections are dropped: the final ACK is ignored, so the client retransmits and eventually times out — and net.ipv4.tcp_abort_on_overflow / ListenOverflows counters climb (nstat, netstat -s).

Limiting process resources: namespaces & cgroups

The kernel primitives behind containers:

NamespaceIsolates
PIDProcess tree (PID 1 inside the container).
NETInterfaces, routing table, iptables, sockets.
MNTMount points / filesystem view.
UTSHostname & domain name.
IPCSysV IPC, POSIX shared memory / semaphores.
USERUID/GID mapping (root inside ≠ root outside).
CGROUPThe cgroup filesystem view.

Namespaces decide what a process can see; cgroups decide how much it can use (CPU, memory, IO, PIDs) and account for it. cgroup v2 is the unified hierarchy. Inspect with lsns, nsenter, systemd-cgls, systemd-cgtop.

Containers vs virtual machines

The single most-asked ops question, so answer it in one line first: a VM virtualizes the hardware and runs its own kernel + OS; a container virtualizes the OS and shares the host's kernel. A VM is a fake machine (courtesy of a hypervisor); a container is just an isolated process (courtesy of namespaces + cgroups).

Container = namespaces (what it can see) + cgroups (how much it can use) + an image (userspace + deps), all running on the host kernel. VM = a hypervisor (KVM, ESXi, Hyper-V) giving a guest virtual CPU/RAM/disk/NIC, on which a full guest OS boots its own kernel.
ContainerVirtual machine
VirtualizesThe OS (a process view)The hardware (a whole machine)
KernelShares the host kernelOwn guest kernel per VM
Isolation byNamespaces + cgroupsHypervisor + CPU virtualization (VT-x/AMD-V)
Start time / overheadMilliseconds; process-lightSeconds; boots a kernel, GBs of RAM/disk
Image sizeMBs (userspace + deps)GBs (whole OS disk image)
DensityHundreds per hostTens per host
Isolation strengthWeaker — shared kernel is the blast radiusStronger — hardware-enforced boundary
Guest OSMust match host kernel (Linux on Linux)Any OS (Windows on Linux, etc.)

Under the hood a container is exactly the namespaces & cgroups from the section above — no magic, just kernel features.

A couple more they like

Related: Linux Basics & Troubleshooting · Performance Triage (USE) · Practical Bash & Ops Tasks.