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 1–15 of 109 questions

1.What is the difference between a process and a thread?BeginnerLinux

A process has its own memory space, file descriptors and PID. Threads live inside a process and share its memory, so they are cheaper to create and switch between but can corrupt each other's data. On Linux both are 'tasks' created with clone(); threads simply share more.

2.How do you find which process is listening on port 8080?BeginnerLinux

ss -ltnp | grep :8080 (or sudo lsof -i :8080). The -l shows listening sockets, -t TCP, -n numeric ports, -p the owning process. Mention you need root to see other users' processes.

3.What do the permissions rwxr-x--- mean, and how do you set them?BeginnerLinux

Owner can read, write and execute; group can read and execute; others have nothing. In octal that is 750: chmod 750 file. For directories, x means 'may enter the directory'.

4.What is the difference between a hard link and a soft (symbolic) link?BeginnerLinux

A hard link is a second name for the same inode, so the data stays until every name is deleted; it can't cross filesystems or point to folders. A soft link is a small file that stores a path; it can point anywhere, but breaks if the target is moved or deleted. Create them with ln file link and ln -s target link.

5.How do you check disk space and find what is using it?BeginnerLinux

df -h shows free space per filesystem. du -sh /var/* | sort -h shows which folders are biggest. ncdu is a friendly interactive version if it is installed.

6.What is the difference between > and >>, and what does 2>&1 mean?BeginnerLinux

> writes output to a file and replaces it; >> appends. 2>&1 sends standard error (file descriptor 2) to wherever standard output (1) is going, so cmd > log 2>&1 captures both.

7.How do you see the last lines of a log and follow new ones?BeginnerLinux

tail -n 100 /var/log/app.log shows the last 100 lines and tail -f keeps printing new lines. For systemd services, journalctl -u app -f does the same from the journal.

8.What does set -euo pipefail do?BeginnerBash Scripting

-e exits on any failing command, -u fails on unset variables, and pipefail makes a pipeline fail if any stage fails, not just the last. Together they stop scripts from silently carrying on after an error.

9.Why should you quote variables, like "$file"?BeginnerBash Scripting

Unquoted variables undergo word splitting and glob expansion, so a filename with spaces or a * breaks the command or matches other files. Quoting keeps the value as one argument.

10.What is the difference between single and double quotes in Bash?BeginnerBash Scripting

Single quotes keep everything literally, so '$HOME' prints $HOME. Double quotes still expand variables and $(...) but stop word splitting and globbing, which is why you use "$var" almost everywhere.

11.How do you check if a command succeeded?BeginnerBash Scripting

Every command sets an exit code in $?: 0 means success. Usually you test it directly: if grep -q ERROR app.log; then ... or chain with cmd && next || fallback.

12.How do you pass arguments to a script and use them?BeginnerBash Scripting

Arguments arrive as $1, $2 and so on; $# is how many there are and "$@" is all of them, each kept separate. Check them early, for example [[ $# -ge 1 ]] || { echo "usage: $0 file"; exit 1; }.

13.What is the difference between [ ] and [[ ]]?BeginnerBash Scripting

[ is the old POSIX test command, so variables must be quoted and && doesn't work inside it. [[ ]] is Bash syntax: safer with empty variables, supports &&, ||, pattern matching and regex with =~. Use [[ ]] in Bash scripts.

14.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.

15.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.