Skip to content
$ lynuxpro

INTERVIEW PREP

Interview questions

570 questions from real DevOps, SRE, platform engineering and MLOps interviews, with the answer an interviewer wants to hear. Try answering out loud first, then open the model answer.

Showing 16–30 of 229 questions

16.Load average is 30 on an 8-core box but CPU is mostly idle. What do you check?SeniorLinux

Load counts tasks running AND in uninterruptible sleep (D state), usually waiting on disk or NFS. Check vmstat 1 (wa, b columns), iostat -x 1 for saturated devices, ps -eo state,pid,cmd | grep ^D for stuck tasks, and dmesg for storage errors.

17.How would you harden SSH on a new server?SeniorLinux

Key-only auth (PasswordAuthentication no), no root login (PermitRootLogin no), restrict users or groups (AllowGroups), keep it patched, limit exposure with a firewall or bastion/SSM, add fail2ban or rate limits, and audit logins. Change one thing at a time and keep a second session open while testing.

18.A server is slow. Walk through how you investigate.SeniorLinux

Start broad, then narrow: uptime for load, top/htop for CPU and memory, vmstat 1 for run queue, swap and I/O wait, iostat -xz 1 for disk, free -m for memory, ss -s for connections, and dmesg/journal for errors like OOM kills. Find which resource is saturated, then which process uses it.

19.What happens, step by step, when you type a command and press Enter?SeniorLinux

The shell reads the line, expands variables and globs, and looks up the command: alias, function, builtin, then each folder in PATH. For an external program it calls fork() to create a child and execve() to load the program; the parent waits and stores the exit code in $?.

20.How does the Linux OOM killer decide what to kill, and how do you protect a process?SeniorLinux

When memory runs out, the kernel picks the process with the highest oom_score, mostly based on memory use. You can lower a process's chance with oom_score_adj (systemd OOMScoreAdjust=). The real fix is right-sizing memory, limits in cgroups, and finding the leak.

21.What is the difference between git fetch and git pull?BeginnerGit

fetch downloads new commits and updates remote-tracking branches without touching your work. pull is fetch plus merge (or rebase) into the current branch.

22.What is the difference between merge and rebase?BeginnerGit

Merge joins two histories with a merge commit and keeps history as it happened. Rebase replays your commits on top of another branch for a linear history, creating new commit IDs. Never rebase commits others have already pulled.

23.What is the difference between the working directory, the staging area and a commit?BeginnerGit

The working directory is your files as they are now. git add copies changes to the staging area (the index), which is what the next commit will contain. git commit saves the staged snapshot into history.

24.What does .gitignore do, and why doesn't it ignore a file I already committed?BeginnerGit

It tells Git which untracked files to leave out, like node_modules/ or .env. Files that are already tracked keep being tracked; remove them from the index with git rm --cached file, then commit.

25.What is the difference between git reset, git revert and git restore?BeginnerGit

git restore throws away changes in files. git reset moves your branch back to an earlier commit (rewrites local history). git revert makes a new commit that undoes an old one, which is safe on shared branches.

26.What is a pull request (merge request), and why use one?BeginnerGit

It is a request to merge one branch into another, with a place to review the diff, discuss it and run CI. It adds a quality gate and a record of why a change was made.

27.You committed a secret and pushed it. What do you do?MidGit

Rotate the secret first, because it is already compromised. Then remove it from history (git filter-repo or BFG), force-push, ask collaborators to re-clone, and add secret scanning to prevent a repeat.

28.How do you undo a commit that is already on main?MidGit

git revert <sha> creates a new commit that undoes it, which is safe on shared branches. reset --hard rewrites history and should only be used on private branches.

29.How do you find which commit introduced a bug?MidGit

git bisect start, mark a bad and a good commit, and test each midpoint Git checks out; git bisect run ./test.sh automates it. It finds the culprit in log2(n) steps.

30.How do you resolve a merge conflict?MidGit

Git marks the conflicting lines with <<<<<<<, ======= and >>>>>>>. Edit the file to the correct final version, remove the markers, git add it, then git commit (or git rebase --continue). Run the tests before pushing.