Permissions • Processes • systemd • Networking • Troubleshooting • 2026

Linux Interview Questions

31 questions What each one tests, an answer frame, a spoken answer 39 min read

This page is for anyone facing a Linux round, whether you're applying for support, DevOps, cloud or backend work. Most Linux interviews start with the file system, permissions and users, move on to processes, signals, systemd services and logs, then test disks, networking commands and the text tools you use every day. Stronger rounds end with a slow or full server to troubleshoot, a production story and a judgement call. Each question shows what the interviewer is really checking, the shape of a strong answer and a short answer you can say out loud. Try the commands on a spare VM, then change the stories to your own.

Search all questions by round, difficulty and level, or save the ones you want to practise.

File System & Disk 5 questions

Easy Technical round Fresher Practice question

1. Walk me through the main top-level folders on a Linux server. Where would you look for config, logs and installed programs?

What the interviewer is really testing:
Whether you can find your way around an unfamiliar server quickly, because almost every troubleshooting task starts with knowing where things live.
Answer frame:

Config: /etc holds system and service configuration as plain text files.

Changing data: /var holds logs, caches, spools and often databases; /tmp is scratch space.

Programs: /usr/bin and /usr/lib for packaged software, /opt for self-contained vendor apps, /usr/local for things installed by hand.

Special: /home and /root for users, /proc and /sys are live views into the kernel, /dev holds device files.

Sample spoken answer:

"Everything hangs off one root, slash, and other disks get mounted somewhere inside that tree. The folders I use most are /etc, where configuration lives, like the SSH server config or a web server's site files, and /var, which is for data that changes: logs under /var/log, package caches, mail spools, often database files too. Installed programs sit in /usr/bin with their libraries in /usr/lib, while /opt is where a vendor app often drops its whole folder, and /usr/local is for things someone built or installed by hand. User homes are under /home, and root's home is /root. Then there are the virtual ones: /proc and /sys aren't real files on disk, they're the kernel showing live information about processes and hardware, and /dev holds device files like disks."

Red flag to avoid:

Treating /tmp as a safe place for important data without knowing it's often cleared on reboot.

They may ask next:
  • What would you expect to find under /proc for a running process?
  • Why do many teams put /var on its own partition or disk?
Say it in 60 seconds
Medium Technical round Fresher, Mid-level Practice question

2. An alert says the root filesystem on a server is full and the app can't write. How do you find what's filling it and free space safely?

What the interviewer is really testing:
Whether you can find the real space hog quickly and free space without deleting something the system or the app still needs.
Answer frame:

Confirm: df -h shows which filesystem is full; df -i rules out running out of inodes instead.

Find: du on that one filesystem, one level at a time, sorted by size, to walk down to the big folder.

Safe wins: old rotated logs, the package cache, the journal with a vacuum, stale core dumps or temp files.

Prevent: a rotation rule, a cleanup job or a bigger disk, plus an alert well before it hits full.

Sample spoken answer:

"First, df -h to see which filesystem is actually full, because /var or /home might be a separate mount. Then I walk down with du, staying on that one filesystem with -x so it doesn't count other mounts, one level deep, sorted by size. I go into the biggest folder and repeat until I find the culprit. It's usually logs under /var/log, a package cache, old core dumps, or an app that writes uploads or temp files and never cleans them. For quick, safe space I'd vacuum the journal, clean the package cache and compress or remove old rotated logs, never a log file an app still has open. If a big file is still in use, I truncate it instead of deleting it. Then I fix the reason it grew, like adding a logrotate rule, and make sure the alert fires well before the disk is completely full next time."

Code:
df -h
sudo du -xh --max-depth=1 / 2>/dev/null | sort -rh | head -n 15
sudo du -xh --max-depth=1 /var 2>/dev/null | sort -rh | head -n 15

sudo journalctl --vacuum-size=500M
sudo apt clean            # or: sudo dnf clean all
sudo truncate -s 0 /var/log/myapp/huge.log   # still open, so empty it
Red flag to avoid:

Deleting files by guesswork under /var or /usr, or removing a log that a running app still holds open.

They may ask next:
  • You delete a big log file, but df still shows the disk as full. Why?
  • How would you stop the same folder from filling the disk again?
Say it in 60 seconds
Hard Technical round Mid-level, Senior Practice question

3. df says a filesystem is full, but adding up du for every folder gives far less. What's going on, and how do you fix it?

What the interviewer is really testing:
Whether you understand that disk space belongs to open files, not file names, which explains many mysterious full disks.
Answer frame:

Deleted but open: a process still holds a deleted file, so its blocks aren't freed until it closes it.

Find it: lsof +L1 lists open files with no name left, with the process and size.

Fix: restart or reload that process, or truncate the file through /proc if you can't restart yet.

Other causes: files hidden under a mount point, and the blocks ext4 keeps back for root.

Sample spoken answer:

"The usual cause is a file that was deleted while a process still had it open. du walks the directory tree, so it only counts files that still have a name. df asks the filesystem how many blocks are in use, and a deleted file's blocks stay in use until the last process closes it. It often happens when someone deletes a huge log by hand while the app keeps writing. I'd find it with lsof +L1, which lists open files with no links left, and it shows me the process and the size. The clean fix is to restart or reload that process so it lets go. If I can't restart right now, I can truncate the file through the process's file descriptor under /proc, which frees the space at once. Rarer causes are files written into a folder before a disk was mounted over it, and the blocks ext4 keeps back for root."

Code:
sudo lsof +L1
# myapp 2211 app 4w REG 253,0 21474836480 0 1311 /var/log/myapp/app.log (deleted)

# free it without a restart: empty the file through the open descriptor
sudo truncate -s 0 /proc/2211/fd/4
Red flag to avoid:

Deleting more files at random, or rebooting production without finding which process was holding the space.

They may ask next:
  • How is running out of inodes different, and how would you spot it?
  • How could you check for files hidden under a mount point without unmounting it?
Say it in 60 seconds
Medium Technical round Mid-level Practice question

4. A new disk has been attached to a server. How do you format it, mount it, and make sure it comes back after a reboot?

What the interviewer is really testing:
Whether you can do basic storage work safely, including the fstab mistakes that stop a server from booting.
Answer frame:

Identify: lsblk to find the new, empty device and be sure it's the right one.

Format and mount: mkfs to create a filesystem, make a mount point, mount it.

Persist: an /etc/fstab line using the UUID from blkid, not the device name.

Test: mount -a or findmnt --verify before any reboot, and nofail for disks the boot doesn't need.

Sample spoken answer:

"First I run lsblk to find the new device, one with no partitions and no mount point, and I check the size so I don't format the wrong disk, because mkfs won't ask twice. Then I create a filesystem, usually ext4 or xfs depending on what the team runs, make a folder like /data and mount it there. To make it survive a reboot I add a line to /etc/fstab, using the UUID from blkid rather than a name like sdb, because device names can change between boots, especially on cloud VMs. The step people skip is testing: I run mount -a, or findmnt --verify, before any reboot. A bad fstab line can drop the server into emergency mode at boot, which on a cloud VM with no easy console is a very bad day. For a data disk the boot doesn't need, I add nofail too."

Code:
lsblk
sudo mkfs.ext4 /dev/sdb
sudo mkdir -p /data
sudo blkid /dev/sdb
# add to /etc/fstab:
# UUID=<uuid-from-blkid>  /data  ext4  defaults,nofail  0  2
sudo mount -a && findmnt /data
Red flag to avoid:

Putting /dev/sdb in fstab and rebooting without testing, or running mkfs without confirming the device.

They may ask next:
  • Why might you put LVM on the disk instead of formatting it directly?
  • The cloud provider lets you grow the disk later. What steps make the extra space usable?
Say it in 60 seconds
Medium Technical round Fresher, Mid-level Practice question

5. Using find, how would you delete files older than two weeks in an app's log folder, and make sure it only hits what you meant?

What the interviewer is really testing:
Whether you can use find precisely, since a careless find with delete is one of the easiest ways to lose data.
Answer frame:

Narrow: a start path, -type f, a -name pattern and -mtime +14.

Dry run: run it with -print first and read the list.

Delete: -delete goes at the very end, after the tests, or use -exec with a plus.

Automate: once it's right, schedule it, or let logrotate own the job.

Sample spoken answer:

"I'd write find with the folder as the start point, -type f so only files match, a -name pattern for the log files, and -mtime +14. find counts age in whole days and rounds down, so +14 really means fifteen days or more. The first run just prints, and I read the list and check the count. Then I add -delete as the last thing on the line. Order matters, because find reads its expression left to right, so a -delete placed before the tests would delete everything it walks into. If I need a different action, like listing sizes or compressing, I use -exec with a plus so it batches the files. For names with spaces, I stick to -delete or -exec rather than piping plain output into xargs, or I use -print0 with xargs -0. Once it's correct I'd schedule it, though for logs a logrotate rule is usually the cleaner answer."

Code:
find /var/log/myapp -type f -name '*.log' -mtime +14 -print     # dry run
find /var/log/myapp -type f -name '*.log' -mtime +14 -delete
find /var/log/myapp -type f -size +100M -exec ls -lh {} +
Red flag to avoid:

Running a delete without a dry run, or putting -delete before the filters.

They may ask next:
  • What's the difference between -mtime, -atime and -ctime?
  • How would you find the biggest files on one filesystem without crossing into other mounts?
Say it in 60 seconds

Access Control 6 questions

Easy Technical round Fresher, Mid-level Practice question

6. Read this permission string for me: -rwxr-x---. Who can do what, and how would you set it with chmod and fix the owner with chown?

What the interviewer is really testing:
Whether you can read ls output at a glance and translate between letters and numbers, which comes up constantly on real servers.
Answer frame:

Type: the first character is the file type; a dash is a regular file, d a directory, l a symlink.

Three sets: owner, then group, then everyone else, each with read, write and execute.

Numbers: read is 4, write is 2, execute is 1; add them per set, so rwx r-x --- is 750.

Ownership: chown user:group sets both; the modes only make sense with the right owner.

Sample spoken answer:

"The first dash tells me it's a regular file. Then it splits into three sets of three. The owner has rwx, so they can read it, change it and run it. The group has r-x, so group members can read and run it but not edit it. Everyone else gets nothing. In numbers, read is 4, write is 2 and execute is 1, so the owner is 7, the group is 5 and others are 0, which is chmod 750. I could also do it symbolically, like chmod o-rwx, which is handy when I only want to change one part. Modes only work alongside ownership, so I'd check the owner and group too and fix them with something like chown appuser:appgroup on the file. On Linux only root can give a file to another user."

Code:
ls -l deploy.sh
# -rwxr-x--- 1 appuser appgroup 812 Sep 10 09:12 deploy.sh
chmod 750 deploy.sh
chmod o-rwx deploy.sh          # symbolic: take everything from others
sudo chown appuser:appgroup deploy.sh
Red flag to avoid:

Reading the middle set as everyone else, or reaching for 777 to make an error go away.

They may ask next:
  • What would chmod 644 mean, and why is it a typical mode for a config file?
  • What is umask, and why does a new file usually come out as 644 rather than 666?
Say it in 60 seconds
Hard Technical round Mid-level, Senior Practice question

7. What do the setuid, setgid and sticky bits do, and where would you see each one on a normal system?

What the interviewer is really testing:
Whether you understand permissions beyond rwx, including the ones that matter for security reviews and shared folders.
Answer frame:

setuid: a program runs with its owner's rights, not the caller's; passwd uses it so users can change their own password.

setgid: on a program it runs with the file's group; on a directory, new files inherit the directory's group.

Sticky: on a shared directory like /tmp, only a file's owner or root can delete or rename it.

Risk: every setuid-root program is attack surface, so reviews list them with find.

Sample spoken answer:

"Setuid on an executable means it runs with the rights of the file's owner rather than the person running it. The classic example is passwd: it's owned by root with setuid, so an ordinary user can run it and it can still update the shadow file that only root can write. In ls you see an s where the owner's x would be. Setgid does the same for the group, but I use it more on directories: set it on a shared team folder and new files inherit that folder's group, so the whole team can keep working on them. The sticky bit is the t you see on /tmp. Everyone can write there, but you can only delete or rename your own files. On the security side, setuid-root programs are a common privilege escalation path, so in a hardening review I'd list them and question anything unexpected."

Code:
ls -ld /usr/bin/passwd /tmp
# -rwsr-xr-x 1 root root ... /usr/bin/passwd
# drwxrwxrwt 12 root root ... /tmp

chmod g+s /srv/shared                            # new files inherit the group
find / -xdev -perm -4000 -type f 2>/dev/null     # list setuid files
Red flag to avoid:

Not seeing why an unexpected setuid-root program is a security problem.

They may ask next:
  • Why does Linux ignore the setuid bit on shell scripts?
  • What does a capital S in the permission string tell you?
Say it in 60 seconds
Easy Technical round Fresher, Mid-level Practice question

8. A new engineer joins. How do you create their account, add them to the right groups and give them sudo without breaking anything?

What the interviewer is really testing:
Whether you know the everyday user commands and the classic traps, like wiping someone's groups or breaking the sudoers file.
Answer frame:

Create: useradd with a home directory and a shell, or adduser on Debian-style systems, then add their SSH key.

Groups: usermod -aG adds a group; without -a the whole list is replaced.

sudo: the admin group (sudo or wheel, depending on the distro) or a small file in /etc/sudoers.d, edited with visudo.

Check: id shows their groups; they need a fresh login for a new group to apply.

Sample spoken answer:

"I'd create the account with useradd -m so they get a home directory and -s to give them bash, or use adduser on a Debian-style box because it walks you through it. Since we log in with keys, I'd put their public key in their authorized_keys rather than set a password. For groups I use usermod -aG with the group name. The -a is what people forget: without it, -G replaces all their extra groups instead of adding one. For sudo, the simple route is the admin group, which is sudo on Debian and Ubuntu and wheel on Red Hat family systems. If they only need a few commands, I write a small rule in /etc/sudoers.d with visudo, because it checks the syntax before saving, and a broken sudoers file can stop everyone using sudo. Then I run id on the user to confirm."

Red flag to avoid:

Using usermod -G without -a, or editing /etc/sudoers with a normal editor on a production box.

They may ask next:
  • Where are user accounts and password hashes stored, and why are they in two different files?
  • How would you lock the account of someone who's leaving without deleting their files?
Say it in 60 seconds
Medium Technical round Fresher, Mid-level Practice question

9. How does SSH key login work, and how would you set it up for yourself and then switch off password logins on the server?

What the interviewer is really testing:
Whether you understand what the keys actually do and can harden SSH without locking yourself out.
Answer frame:

Keys: a key pair; the public key goes in authorized_keys on the server, the private key never leaves your machine.

Login: your client proves it holds the private key by signing data the server checks with the public key.

Permissions: sshd ignores keys if the home folder, .ssh or authorized_keys is writable by others.

Harden: turn off password and root login, test with sshd -t, and keep a second session open.

Sample spoken answer:

"I generate a key pair on my laptop, these days ed25519, with a passphrase. The public half goes into authorized_keys in the .ssh folder of my account on the server, usually with ssh-copy-id. When I connect, the server checks my public key is listed and asks me to prove I hold the matching private key. My client signs some data with it and the server checks the signature with the public key, so the private key never leaves my machine. If it doesn't work, it's usually permissions: sshd ignores authorized_keys if the home folder, .ssh or the file itself is writable by others. Once key login works, I set PasswordAuthentication no and PermitRootLogin no in sshd_config, test the file with sshd -t, and reload. The habit that matters is keeping my current session open and testing a fresh login from a second terminal before closing anything."

Code:
ssh-keygen -t ed25519 -C "me@laptop"
ssh-copy-id deploy@server.example.com

# on the server, in /etc/ssh/sshd_config:
#   PasswordAuthentication no
#   PermitRootLogin no
sudo sshd -t && sudo systemctl reload sshd   # Red Hat family
sudo sshd -t && sudo systemctl reload ssh    # Debian and Ubuntu call the unit ssh
Red flag to avoid:

Switching off password login and closing the only session before testing that key login works.

They may ask next:
  • You set PasswordAuthentication to no, but passwords still work. What would you check?
  • How would you give a CI system access to deploy without sharing a person's key?
Say it in 60 seconds
Medium Situational round Fresher, Mid-level Practice question

10. A teammate fixes a 'permission denied' error by running chmod -R 777 on the app folder, and the app works again. What do you do?

What the interviewer is really testing:
Whether you see the security problem, can find the real fix, and can raise it without making it personal.
Answer frame:

Risk: any user or compromised process can now change the code and config and read any secrets there.

Real cause: find which user the app runs as and which file or folder it actually needed.

Fix: correct owner and group, tight modes, write access only where the app writes.

Talk: explain it privately and add the step to the deploy so it doesn't come back.

Sample spoken answer:

"I'd treat it as something to fix today, not a style point. 777 means every user on the box, and any compromised process, can rewrite the app's code and config and read whatever secrets are in there. First I'd find the real cause. I'd check which user the service runs as, from the unit file or ps, and look at the original error, which usually names the file. Often the deploy was done as root, so the files ended up owned by root, or one upload folder needed group write. Then I'd set the right owner and group with chown and put back sensible modes, like 750 for folders, 640 for files and 600 for secrets, with write access only where the app writes. I'd talk to the teammate one to one, show how I found the actual file, and suggest we add the ownership step to the deploy script."

Red flag to avoid:

Leaving 777 in place because it works, or fixing it without finding what actually needed access.

They may ask next:
  • How would you find every world-writable file on the server?
  • The app needs to write uploads to one folder. How would you set that up?
Say it in 60 seconds
Medium Situational round Mid-level, Senior Practice question

11. A developer asks for full root access on a production server so they can debug an outage faster. How do you handle it?

What the interviewer is really testing:
Whether you can balance speed during an incident against least privilege and an audit trail.
Answer frame:

Need: find out exactly what they need to see or do right now.

Narrow: read access to logs, one sudo rule, or pair with them on the box.

Time-box: if broad access is truly needed, make it approved, logged and temporary.

Follow up: close the gap so next time they don't need the server at all.

Sample spoken answer:

"I wouldn't just say no, because an outage is real pressure and blocking them makes it worse. I'd ask what they're trying to do. Usually it's reading logs, checking a config or restarting their service. Reading logs can be covered by adding them to the group that can read the journal or the app's log folder, and a restart can be one sudo rule for that one unit. Often the fastest option is getting on a call and running the commands together while they watch. If they truly need broad access, I'd use our break-glass process: approved, time-limited, with sudo logging, and removed afterwards. Then, after the incident, I'd look at why they needed the server at all. If the logs were in a central place they could search, most of these requests would go away."

Red flag to avoid:

Handing out permanent root to save time, or refusing flat out with no alternative during an outage.

They may ask next:
  • How would you let someone restart one service with sudo and nothing else?
  • What would you do if a manager told you to just give them root?
Say it in 60 seconds

Processes 3 questions

Easy Technical round Fresher, Mid-level Practice question

12. How do you find which processes are using the most CPU and memory right now, and what do the key numbers in top mean?

What the interviewer is really testing:
Whether you can read the first screen everyone opens on a busy server without misreading its numbers.
Answer frame:

Live view: top or htop, sorted by CPU or memory, with the load average and CPU breakdown at the top.

Snapshot: ps with chosen columns and a sort, handy for scripts and tickets.

CPU line: us is app code, sy is the kernel, wa is waiting on disk, st is time taken by the hypervisor.

Memory: RES is real memory in use; VIRT is mapped address space and often looks scary for no reason.

Sample spoken answer:

"For a live view I open top, or htop if it's installed. At the top I read the load average, then the CPU line: us is time in application code, sy is kernel time, id is idle, wa is time waiting on disk, and st is time the hypervisor gave to other guests, which matters on cloud VMs. In the process list I press shift-M to sort by memory or shift-P for CPU. For memory I look at RES, the resident memory the process really holds, not VIRT, which counts all the address space it has mapped and is often huge without meaning much. A process showing well over a hundred in the CPU column is simply using more than one core. When I want a snapshot for a ticket, I use ps with the columns I care about and a sort, keeping in mind that its CPU figure is an average over the life of the process, not this second."

Code:
ps -eo pid,user,pcpu,pmem,rss,comm --sort=-pcpu | head -n 10
ps -eo pid,user,pcpu,pmem,rss,comm --sort=-rss  | head -n 10
Red flag to avoid:

Judging memory use from VIRT, or calling a server overloaded from the load number without knowing how many cores it has.

They may ask next:
  • What does the load average actually count, and how do you judge it against the number of cores?
  • How would you see which threads inside a single process are the busy ones?
Say it in 60 seconds
Easy Technical round Fresher, Mid-level Practice question

13. What's the difference between kill, kill -15 and kill -9, and why shouldn't kill -9 be your first move?

What the interviewer is really testing:
Whether you know processes get a chance to shut down cleanly, and what you lose when you skip it.
Answer frame:

Default: plain kill sends SIGTERM, which is signal 15, so the first two are the same.

SIGTERM: a polite request; the program can catch it, finish work, flush data and exit.

SIGKILL: signal 9 can't be caught or ignored; the kernel ends the process with no clean-up.

Order: TERM, wait a few seconds, only then KILL; HUP often means reload for daemons.

Sample spoken answer:

"Plain kill with no number sends SIGTERM, which is signal 15, so kill and kill -15 do the same thing. SIGTERM asks the process to stop, and a well-written program catches it, finishes the request it's on, closes files and database connections, removes its lock file and exits. SIGKILL, signal 9, is different: the process never gets to react, the kernel just removes it. That's why it's a last resort. You can be left with half-written files, stale lock files, or a database that has to recover on the next start. So my habit is to send TERM, wait some seconds, check with ps, and only then use -9. Many daemons also treat SIGHUP as reload your config, so for those a HUP is gentler than a restart. systemd follows the same order when it stops a service: TERM first, KILL after a timeout."

Red flag to avoid:

Using kill -9 as the normal way to stop things, or not knowing that plain kill already sends SIGTERM.

They may ask next:
  • A process is still listed after kill -9. What could it be doing?
  • How would you make your own shell script remove its temp file when it receives SIGTERM?
Say it in 60 seconds
Hard Technical round Mid-level, Senior Practice question

14. An app keeps dying at random with nothing in its own logs. How would you check whether the kernel's OOM killer is ending it?

What the interviewer is really testing:
Whether you know where the kernel records memory kills and can tell a machine-wide shortage from a limit set on one service.
Answer frame:

Evidence: kernel messages in dmesg or journalctl -k report an out of memory kill and name the process.

Signs: exit code 137 means killed by signal 9; systemd marks the unit failed with the result oom-kill.

Scope: was the whole machine short, or did a cgroup memory limit on the service or container trigger it?

Fix: find the leak or the spike, set honest limits, size the machine; swap only buys time.

Sample spoken answer:

"When a process dies without a word in its own log, I suspect something outside killed it, and the OOM killer is top of the list. The kernel logs every kill, so I search dmesg -T or journalctl -k for out of memory or killed process, which names the victim and how much memory it held. Other clues: an exit code of 137, which is 128 plus 9, meaning SIGKILL, and systemctl status often shows the unit failed with the result oom-kill. Then I work out the scope. If the whole machine ran out, I look at what grew, using memory graphs if we have them. If the service or container has a memory limit through its cgroup, it can be killed while the host still has plenty free, so I compare the limit with real usage. The fix is finding the leak or the spike, then setting honest limits and sizing the machine."

Code:
sudo dmesg -T | grep -iE 'out of memory|killed process'
journalctl -k --since today | grep -i oom
systemctl status myapp          # Active: failed (Result: oom-kill)
systemctl show myapp -p MemoryMax
Red flag to avoid:

Blaming the app's code without checking the kernel log, or switching off the OOM killer as the fix.

They may ask next:
  • How does the kernel pick which process to kill, and can you influence it?
  • Why doesn't adding a lot of swap really fix this?
Say it in 60 seconds

Services & Logs 3 questions

Medium Technical round Mid-level, Senior Practice question

15. You need an app to start on boot, run as a non-root user and restart if it crashes. How would you set that up with systemd?

What the interviewer is really testing:
Whether you can run a service properly instead of starting it by hand in a terminal and hoping it stays up.
Answer frame:

Unit file: a small file in /etc/systemd/system with Unit, Service and Install sections.

Service: ExecStart with the full path, User set to a service account, Restart=on-failure.

Order: After and Wants on network-online.target so it starts once the network is up.

Enable: daemon-reload, then enable --now, then check status and the journal.

Sample spoken answer:

"I'd write a unit file under /etc/systemd/system, say myapp.service. In the Service section I set ExecStart to the full path of the binary and its arguments, because systemd doesn't use my shell's PATH. I set User to a dedicated account that owns only the app's folder, plus WorkingDirectory, and I load settings from an EnvironmentFile with tight permissions rather than putting secrets in the unit itself. Restart=on-failure with a short RestartSec gives crash recovery without a tight loop. In the Unit section, After and Wants on network-online.target make it wait for the network. The Install section with WantedBy=multi-user.target is what lets enable start it at boot. Then systemctl daemon-reload so systemd reads the new file, systemctl enable --now to start it and turn it on for boot, and I check status and journalctl for the unit."

Code:
[Unit]
Description=My web app
Wants=network-online.target
After=network-online.target

[Service]
User=myapp
WorkingDirectory=/opt/myapp
EnvironmentFile=/etc/myapp/env
ExecStart=/opt/myapp/bin/server --port 8080
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
Red flag to avoid:

Starting the app with nohup from a login shell and calling it a service, or running it as root because permissions were annoying.

They may ask next:
  • What's the difference between systemctl enable and systemctl start?
  • How would you change one setting of a unit that came from a package without editing the packaged file?
Say it in 60 seconds
Easy Technical round Fresher, Mid-level Practice question

16. A service won't start after a config change. How do you find out why, using systemctl and journalctl?

What the interviewer is really testing:
Whether you go straight to the evidence the system already keeps, instead of guessing and restarting in a loop.
Answer frame:

Status: systemctl status shows the state, the exit code and the last few log lines.

Journal: journalctl -u for the unit, jumping to the end, or limited to this boot or a time window.

Config test: many daemons have a check mode, like nginx -t or sshd -t, that catches syntax errors.

Change: compare with the last known good config and roll back if the fix isn't obvious.

Sample spoken answer:

"First I run systemctl status on the service. It tells me whether it failed or is stuck restarting, shows the exit code, and prints the last few lines of its log, which is often enough. If not, I use journalctl -u with the unit name and -e to jump to the end, or --since with something like ten minutes ago to cut the noise, and -b to stay within the current boot. After a config change, the message is usually a syntax error on a given line, a port already in use, or permission denied on a file. Many daemons have a config test mode, like nginx -t or sshd -t, so I run that before trying again. If I still can't see it, I diff the config against the backup or the last version in git, and if the service matters, I roll back first and debug after."

Code:
systemctl status nginx
journalctl -u nginx -e
journalctl -u nginx -b --since "10 min ago"
sudo nginx -t
Red flag to avoid:

Restarting the service over and over without reading a single log line.

They may ask next:
  • The journal shows nothing at all for the unit. What would you check next?
  • How do you make the journal keep its logs across reboots?
Say it in 60 seconds
Medium Technical round Fresher, Mid-level Practice question

17. Where do logs live on a Linux server, and how do you stop them from quietly filling the disk?

What the interviewer is really testing:
Whether you know both logging layers on a modern server and have set up rotation, since log growth is a very common cause of a full disk.
Answer frame:

Two layers: the systemd journal, read with journalctl, and text files under /var/log.

Distro names: system messages in syslog on Debian-style systems or messages on Red Hat-style ones; logins in auth.log or secure.

Rotation: logrotate rotates, compresses and removes old files by age or size; the journal has its own limits.

App logs: give every app log folder a rule, or have the app log to stdout for the journal.

Sample spoken answer:

"On a modern server there are two layers. systemd's journal collects the output of every service, and I read it with journalctl. Then there's /var/log with plain text files, often written by rsyslog: general messages in syslog on Debian and Ubuntu or messages on Red Hat family systems, logins and sudo in auth.log or secure, plus folders for things like nginx. To stop growth, logrotate runs daily with rules in /etc/logrotate.d: how many copies to keep, compress the old ones, rotate by size or age. The trap is an app writing its own log files with no rule, so I add one for each. The journal has separate limits, like SystemMaxUse in journald.conf, and journalctl --vacuum-size frees space straight away. If an app keeps its log file open, I use copytruncate or a reload after rotating, or it keeps writing to the old file."

Code:
/var/log/myapp/*.log {
    daily
    rotate 14
    compress
    delaycompress
    missingok
    notifempty
    copytruncate
}
Red flag to avoid:

Deleting big log files by hand every time the disk fills, with no rotation in place.

They may ask next:
  • Why can a log file you deleted still be using disk space?
  • What's the trade-off of using copytruncate?
Say it in 60 seconds

Networking 3 questions

Easy Technical round Fresher, Mid-level Practice question

18. How do you see which ports a server is listening on, and which process owns each one?

What the interviewer is really testing:
Whether you know the modern command for this and can read what the output says about who can connect.
Answer frame:

Command: ss -tulpn lists TCP and UDP listeners with their processes; use sudo to see every owner.

Address: 0.0.0.0 or [::] means all interfaces; 127.0.0.1 means only this machine.

One port: an ss filter or lsof -i answers who holds a single port.

Sample spoken answer:

"I use ss -tulpn. The letters mean TCP, UDP, listening sockets only, show the process, and numeric ports instead of service names. I run it with sudo, because otherwise I can't see the owners of processes that belong to other users. The column I read carefully is the local address. If a service is on 127.0.0.1, it's only reachable from the machine itself, which is a very common reason an app answers curl on the box but not from outside. If it's 0.0.0.0 or the IPv6 equivalent, it's listening on every interface. When I only care about one port, like an 'address already in use' error on 8080, I filter for it or run lsof -i on that port to get the PID, and I check what that process is before stopping anything. netstat does the same job, but it comes from an older package many distros no longer install by default."

Code:
sudo ss -tulpn
sudo ss -ltnp 'sport = :8080'
sudo lsof -i :8080
Red flag to avoid:

Not noticing the difference between a service bound to localhost and one bound to all interfaces.

They may ask next:
  • The port is listening but a remote client still can't connect. What do you look at?
  • How would you count the established connections to a database port?
Say it in 60 seconds
Medium Technical round Mid-level Practice question

19. Users say they can't reach a web app on one of your servers. Working from the server itself, how do you narrow down where it breaks?

What the interviewer is really testing:
Whether you troubleshoot in layers, from the process outward, instead of guessing or disabling the firewall.
Answer frame:

Process: is the service running and listening, and on which address and port?

Locally: curl -v to localhost, then to the server's own IP, to separate app errors from binding.

Host firewall: ufw, firewalld or nftables rules for that port.

Beyond the box: cloud network rules, load balancer health checks, DNS with dig, routes with ip route.

Sample spoken answer:

"I work from the inside out. First, is the service up? systemctl status and its journal. Then, is it listening, and where? ss -tlnp gives me the port and address, and if it's bound to 127.0.0.1 only, that's the answer. Next I curl it locally with -v, first on localhost and then on the server's own IP, so I see whether the app answers and with what status. If that works, the host firewall is next: ufw status, firewall-cmd --list-all or the nftables ruleset, depending on the distro. After that it's outside the server: the cloud security group or network rules, the load balancer's health checks, and whether the DNS name actually points here, which I check with dig. ip addr and ip route show the addresses and default gateway if I suspect the network setup itself. Each step rules out a whole layer."

Red flag to avoid:

Restarting the app or switching off the firewall before finding which layer actually fails.

They may ask next:
  • curl gets 'connection refused' from one client and a timeout from another. What does that difference tell you?
  • How would you check whether packets are reaching the server at all?
Say it in 60 seconds
Hard Technical round Mid-level, Senior Practice question

20. dig returns the right IP for a hostname, but your app on the same server still connects to an old address. How can that happen?

What the interviewer is really testing:
Whether you know how name lookup really works on Linux, and that dig doesn't follow the same path as most programs.
Answer frame:

Different path: dig asks a DNS server directly; normal programs use the system resolver, which checks /etc/hosts first by default.

Order: /etc/nsswitch.conf sets the lookup order; /etc/resolv.conf says which DNS server to ask.

Caches: a local caching resolver, or the app's own runtime, can hold an old answer.

Check: getent hosts shows what the system resolver gives to apps.

Sample spoken answer:

"dig is a DNS tool, so it asks a DNS server directly and skips everything else. Most programs don't do that. They call the system resolver, and on Linux that follows /etc/nsswitch.conf, which normally says check /etc/hosts first and DNS after. So the first thing I'd look for is a stale line in /etc/hosts, often left over from a migration. I'd run getent hosts on the name, because that goes through the same path as the app and shows what it really sees. After that, caching. Many systems run systemd-resolved as a local stub, which is why resolv.conf may point at 127.0.0.53, and it can hold an answer until its TTL runs out. Some language runtimes also cache lookups inside the process, sometimes until a restart, so a long-running app can keep an old address even after everything else is fixed."

Code:
dig +short api.example.com
getent hosts api.example.com
grep api.example.com /etc/hosts
cat /etc/resolv.conf
resolvectl flush-caches      # on systems that use systemd-resolved
Red flag to avoid:

Assuming dig shows exactly what every program on the box will resolve.

They may ask next:
  • How would you ask one specific DNS server what it returns, bypassing the local resolver?
  • What does a record's TTL control, and why lower it before a migration?
Say it in 60 seconds

Text Processing 2 questions

Medium Technical round Fresher, Mid-level Practice question

21. How would you search a folder of config files for an old hostname with grep, then replace it everywhere with sed without wrecking anything?

What the interviewer is really testing:
Whether you can use the two workhorse text tools together and are careful before an in-place edit.
Answer frame:

Find first: grep -rn lists every file and line; -l gives just the file names.

Preview: run sed without -i so the result only prints to the screen.

Edit safely: sed -i with a backup suffix, escaped dots, and another delimiter when the text has slashes.

Verify: grep again for the old value, then run the service's config test.

Sample spoken answer:

"I'd start with grep -rn on the folder to see every match with its file and line number, or -l if I just want the file list. I read that list before changing anything, because sometimes the old name appears somewhere it should stay, like a comment or a different service. Then I preview the sed replacement without -i, so it just prints the result. When I'm happy, I run sed -i with a backup suffix like .bak, which keeps the originals. Two details matter. In a regex a dot means any character, so I escape the dots in a hostname. And if the text contains slashes, I use a different delimiter, like a pipe, instead of escaping every slash. Afterwards I grep again, skipping the .bak files, to make sure nothing's left, run the service's config test, and only then remove the backups."

Code:
grep -rn 'db-old\.internal' /etc/myapp/
sed 's|db-old\.internal|db-new.internal|g' /etc/myapp/app.conf     # preview only
grep -rl --null 'db-old\.internal' /etc/myapp/ \
  | xargs -0 -r sed -i.bak 's|db-old\.internal|db-new.internal|g'
grep -rn --exclude='*.bak' 'db-old\.internal' /etc/myapp/ || echo "none left"
Red flag to avoid:

Running sed -i across a whole tree with an unescaped pattern and no preview or backup.

They may ask next:
  • How does sed -i behave differently on macOS compared with Linux?
  • How would you change the value only on lines that start with a particular key?
Say it in 60 seconds
Medium Coding round Fresher, Mid-level Practice question

22. Given a web server access log, write a one-liner that prints the ten client IPs sending the most requests.

What the interviewer is really testing:
Whether you can chain small tools into a quick answer during an incident, and understand why each step is there.
Answer frame:

Extract: awk prints the first field, which is the client IP in the common log format.

Count: sort groups identical lines so uniq -c can count them; uniq only merges neighbours.

Rank: sort -rn by the count and head for the top ten.

Scale: on big files, let awk count in one pass with an associative array.

Sample spoken answer:

"In the usual access log format the client IP is the first field, so I have awk print field one. Then I sort, because uniq -c only counts identical lines that sit next to each other, so without sorting first the counts come out broken. uniq -c puts a count in front of each IP, sort -rn puts the biggest counts on top, comparing them as numbers, and head gives me ten. On a very large file the first sort is the slow part, so I'd let awk do the counting in a single pass with an associative array keyed by IP, and only sort the small result. And if the server sits behind a load balancer or proxy, I'd check which field really holds the client address, because the first field might just be the balancer."

Code:
awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -n 10

# one pass, better for big files
awk '{hits[$1]++} END {for (ip in hits) print hits[ip], ip}' access.log | sort -rn | head -n 10
Red flag to avoid:

Leaving out the first sort and not knowing why the counts come out wrong.

They may ask next:
  • How would you do the same for only the requests that returned a 5xx status?
  • How would you include yesterday's rotated, gzipped log as well?
Say it in 60 seconds

Scripting & Automation 3 questions

Medium Technical round Fresher, Mid-level Practice question

23. How do you schedule a script to run at 2:30 every weekday morning, and why do scripts that work by hand so often fail under cron?

What the interviewer is really testing:
Whether you can write a cron line from memory and know the environment differences that make jobs fail silently.
Answer frame:

Schedule: five fields, minute, hour, day of month, month, day of week, so 30 2 * * 1-5.

Environment: cron runs with a tiny PATH, plain sh, no login profile, and the home folder as its working directory.

Output: send stdout and stderr to a log, or failures vanish.

Alternative: a systemd timer logs to the journal and can catch up on missed runs.

Sample spoken answer:

"The cron line is 30, 2, star, star, 1 to 5, then the full path to the script. The five fields are minute, hour, day of month, month and day of week, and 1 to 5 means Monday to Friday. I add it with crontab -e as the user who should run it, or as a file in /etc/cron.d for system jobs, which also takes a user field. Scripts break under cron because it doesn't load your shell profile. The PATH is minimal, so commands your terminal finds aren't found, variables from your bashrc aren't there, the shell is plain sh unless the script says otherwise, and the working directory is the user's home folder, so relative paths break. So I use full paths, set PATH at the top of the script, and redirect stdout and stderr to a log. For new jobs I often use a systemd timer instead, because output lands in the journal and Persistent=true runs a job that was missed while the server was off."

Code:
# crontab -e
30 2 * * 1-5 /opt/scripts/nightly-report.sh >> /var/log/nightly-report.log 2>&1
Red flag to avoid:

Relying on the same PATH and variables as your interactive shell and never capturing the job's output.

They may ask next:
  • How would you stop two copies of the job running at once if one run is slow?
  • Where would you look to confirm cron actually started the job last night?
Say it in 60 seconds
Hard Coding round Mid-level, Senior Practice question

24. Write a small bash script that backs up a folder to a dated archive and stops on the first error. What makes a shell script safe for production?

What the interviewer is really testing:
Whether you write scripts that fail loudly and handle odd input, rather than ones that carry on after an error and do damage.
Answer frame:

Fail fast: set -euo pipefail so errors, unset variables and failed pipes stop the script.

Quote everything: double-quote variables so spaces and empty values don't split or vanish.

Check input: validate arguments and paths first; errors go to stderr with a non-zero exit.

Clean up: a trap on EXIT removes temp files; shellcheck before shipping.

Sample spoken answer:

"The first line after the shebang is set -euo pipefail. The e stops the script when a command fails, the u turns a mistyped variable name into an error instead of an empty string, and pipefail makes a pipeline fail if any stage fails, not just the last one. Then I quote every variable. The classic disaster is an rm on a path built from an empty variable, which ends up pointing much higher up the tree than intended. I check the argument before doing anything, and send errors to stderr with a non-zero exit so cron or CI sees the failure. I write the archive to a temp file from mktemp and only rename it when tar succeeds, with a trap on EXIT that removes the temp file if the script dies halfway. And I run shellcheck, which catches most quoting mistakes before they bite."

Code:
#!/usr/bin/env bash
set -euo pipefail

src="${1:?usage: backup.sh <folder>}"
dest="/var/backups"
stamp="$(date -I)"

if [[ ! -d "$src" ]]; then
  echo "not a folder: $src" >&2
  exit 1
fi

name="$(basename "$src")"
tmp="$(mktemp "$dest/.$name.XXXXXX")"
trap 'rm -f "$tmp"' EXIT

tar -czf "$tmp" -C "$(dirname "$src")" "$name"
mv "$tmp" "$dest/$name-$stamp.tar.gz"
echo "backup written to $dest/$name-$stamp.tar.gz"
Red flag to avoid:

Unquoted variables in rm or cp commands and no error handling, so the script carries on after a failure.

They may ask next:
  • In which situations does set -e not stop a script even though a command failed?
  • How would you test this script before scheduling it on a real server?
Say it in 60 seconds
Medium Behavioral round Mid-level Practice question

25. Tell me about a repetitive task on Linux servers that you automated. How did you make sure the automation itself was safe?

What the interviewer is really testing:
Whether you reach for automation on your own and think about what happens when your script is wrong.
Answer frame:

Task: what was done by hand, how often, and what mistakes it caused.

Build: the script or tool, and how you tried it on one server first.

Safety: a dry-run mode, logging, fail-fast, and a way back.

Result: time saved or errors removed, in plain terms.

Sample spoken answer:

"In my previous role we set up new users on about twenty servers by hand, copying keys and adding groups, and someone was always missing a server or a group. I wrote a script that read a small list of users and their public keys, created the accounts, set the groups and installed the keys, and it could run again without changing anything that was already right. I gave it a dry-run flag that only printed what it would do, tried it on one test server, then two real ones, before the rest. It logged every change with the time and the server. Later the team moved the same logic into a configuration management tool, which was the right long-term home. Onboarding went from half a day of copy and paste to a few minutes, and our access reviews stopped finding strays."

Red flag to avoid:

An automation story with no testing, no dry run and no thought about what happens if it runs twice.

They may ask next:
  • How did you handle removing access when someone left?
  • What would you do differently if you built it again today?
Say it in 60 seconds

Packages & Boot 3 questions

Easy Technical round Fresher, Mid-level Practice question

26. How do package managers differ between Debian-based and Red Hat-based systems, and how do you find which package a file came from?

What the interviewer is really testing:
Whether you can work on either family of distro without fumbling, and trace a file back to its package while debugging.
Answer frame:

Two layers: apt over dpkg on Debian and Ubuntu; dnf, or yum on older releases, over rpm on Red Hat family systems.

Refresh vs upgrade: apt update refreshes the package lists; apt upgrade installs newer versions.

Which package: dpkg -S or rpm -qf on a path.

Pinning: hold a version when an upgrade would break something, and write down why.

Sample spoken answer:

"Both families have a low-level tool that installs a single package file, dpkg on Debian and Ubuntu and rpm on Red Hat, Rocky or Fedora, and a higher-level tool on top that talks to repositories and resolves dependencies: apt on one side, dnf on the other, with yum on older releases. A common mix-up with apt is update versus upgrade. update only refreshes the package lists, upgrade actually installs newer versions. To find which package owns a file, say a binary or a config file, I run dpkg -S with the path, or rpm -qf on the Red Hat side. That helps when a config gets overwritten, or when I need to know whose changelog to read. And if one upgrade would break something, I can hold that package, for example with apt-mark hold, and leave a note saying why so it isn't forgotten."

Code:
# Debian / Ubuntu
sudo apt update && sudo apt upgrade
dpkg -S /usr/sbin/sshd

# RHEL / Rocky / Fedora
sudo dnf upgrade
rpm -qf /usr/sbin/sshd
Red flag to avoid:

Thinking apt update installs updates, or not knowing how to trace a file back to its package.

They may ask next:
  • How would you see which packages have security updates waiting?
  • Why is piping a script from curl straight into a shell risky on a server?
Say it in 60 seconds
Medium Technical round Mid-level Practice question

27. Walk me through what happens when a Linux server boots, from power-on to the point where your services are running.

What the interviewer is really testing:
Whether you know the stages well enough to tell which one broke when a server won't come up.
Answer frame:

Firmware: BIOS or UEFI checks the hardware and hands over to a bootloader, usually GRUB.

Kernel: GRUB loads the kernel and an initramfs, which has what's needed to find the real root filesystem.

Init: the initramfs mounts the real root and switches to it, then PID 1 starts, which is systemd on most distros.

Targets: systemd mounts filesystems and starts units in dependency order up to the default target.

Sample spoken answer:

"The firmware, BIOS or more often UEFI now, runs its checks and finds a bootloader, usually GRUB. GRUB loads the chosen kernel along with an initramfs, a small temporary root filesystem holding the drivers and tools needed to reach the real root disk, like storage drivers, LVM or disk encryption. The kernel sets up the hardware and runs the initramfs, which finds and mounts the real root filesystem and switches over to it. Then PID 1 starts, which on most distros today is systemd. systemd then works through its units in dependency order, mounting what's in fstab, bringing up the network and starting services, until it reaches the default target, usually multi-user on a server. Knowing the stages tells me where to look. Stuck at a GRUB prompt means the bootloader or its config. A kernel panic about the root filesystem often points at the initramfs. Landing in emergency mode is usually a bad fstab line or a failed mount."

Red flag to avoid:

Not being able to say what the initramfs is for, or jumping from BIOS straight to a login prompt.

They may ask next:
  • How would you see which services slowed down the last boot?
  • A cloud VM won't boot after a change and you can't SSH in. What are your options?
Say it in 60 seconds
Hard Situational round Mid-level, Senior Practice question

28. A critical kernel security fix needs a reboot, but the server runs an important service with no second node. How do you handle it?

What the interviewer is really testing:
Whether you can weigh security risk against uptime, communicate clearly, and plan a change with a way back.
Answer frame:

Assess: how exposed this server is to the flaw, and how urgent the fix really is.

Plan: agree a window with the service owner, warn users, keep the old kernel as a fallback.

Execute: snapshot or backup, patch, reboot, confirm the running kernel and a real request.

Root cause: a server that can't be rebooted is the bigger risk; push for a second node.

Sample spoken answer:

"First I'd read the advisory and work out how exposed we are. A remotely exploitable flaw on an internet-facing box is far more urgent than a local one on an internal server with few users. Then I'd agree the quietest window with the service owner and warn users ahead of time. Before patching I'd take a snapshot or check the backup, and confirm the previous kernel is still installed so GRUB can boot it if the new one misbehaves. In the window I install the update, reboot, check uname -r shows the new kernel, and test the service with a real request, not just a running process. If no window was possible soon, I'd look at interim steps like tighter firewall rules. Afterwards I'd raise the bigger issue: one server that can never go down is a risk in itself, and a second node would make the next patch routine."

Red flag to avoid:

Rebooting production without warning anyone, or putting the patch off indefinitely because the service matters.

They may ask next:
  • How would you check which servers are still running the old kernel after a rollout?
  • What would you do if the server didn't come back after the reboot?
Say it in 60 seconds

Troubleshooting 3 questions

Hard Technical round Mid-level, Senior Practice question

29. You get paged because a Linux server is slow. What do you run in the first five minutes, and what are you looking for with each command?

What the interviewer is really testing:
Whether you have a calm, repeatable checklist that covers CPU, memory, disk and network, rather than one favourite command.
Answer frame:

Big picture: uptime for the load trend; dmesg or the kernel journal for OOM kills and disk errors.

CPU and memory: top for who's busy and the wa and st numbers; free -h and vmstat for swapping.

Disk: df -h for space, iostat -x for a device that's saturated.

Network and app: ss -s for connection counts, then the app's logs and what changed recently.

Sample spoken answer:

"I start with uptime, because the three load averages tell me whether it's getting worse or calming down. Then dmesg with readable times, or journalctl -k, to catch the kernel complaining: OOM kills, disk errors, network drops. Next top: which process is busy, and the CPU line, where high wa means processes waiting on disk and high st on a VM means the host is short of CPU. free -h shows available memory, and vmstat 1 for a few seconds shows swapping in the si and so columns. For disk, df -h for space and iostat -x, if sysstat is installed, for a device that's nearly always busy. ss -s gives a quick count of connections. Then I ask what changed: a deploy, a new cron job, a traffic spike. Most slow servers come down to CPU, memory, disk or a slow dependency like the database, and this order finds which."

Red flag to avoid:

Restarting the service first and losing the evidence of what was actually wrong.

They may ask next:
  • top shows the CPU mostly idle, but the app is still slow. Where do you look next?
  • How would you tell whether the slowness is this server or a service it depends on?
Say it in 60 seconds
Medium Behavioral round Mid-level, Senior Practice question

30. Tell me about a production issue on a Linux server that you tracked down. What did you check first, and what turned out to be the cause?

What the interviewer is really testing:
Whether you've done real hands-on debugging and can explain your reasoning, not just list commands.
Answer frame:

Situation: the symptom users saw and how urgent it was.

Path: the commands you ran, in order, and what each one ruled in or out.

Cause and fix: the real root cause, the quick fix and the lasting one.

After: the alert, runbook note or change that stops a repeat.

Sample spoken answer:

"At my last company our API started timing out every night around two. CPU looked fine in top, but the wa number was high, and iostat showed the data disk fully busy. iotop pointed at a backup job, a tar of the whole uploads folder, that someone had moved from Sunday to every night. It was hammering the same disk the database used. The quick fix was moving the job back to Sunday morning while we worked on a better one. The real fix was switching the backup to a snapshot of the volume instead of reading every file, which took that load off the disk. Afterwards I added an alert on disk wait time, and a line in our runbook: when a slowdown happens at the same time every day, check the scheduled jobs first."

Red flag to avoid:

A story with no specific commands or evidence, or one where the fix was a reboot and nobody learned the cause.

They may ask next:
  • What would you have done if iostat hadn't pointed anywhere obvious?
  • How did you confirm the fix actually worked?
Say it in 60 seconds
Medium Behavioral round Fresher, Mid-level Practice question

31. Tell me about a time a command you ran on a server did more than you expected. How did you recover, and what do you do differently now?

What the interviewer is really testing:
Whether you own mistakes honestly and turned them into better habits, which matters a lot for anyone with root access.
Answer frame:

What happened: the command, the context and the impact, told plainly.

Recovery: how you noticed, who you told, and how you restored things.

Habit: the concrete change, like dry runs, checking where you are, or a backup before edits.

Sample spoken answer:

"Early on I was sitting in a root shell on a staging server, fixing ownership for an app, and ran a recursive chown on the current folder, thinking I was in the app's directory. I'd actually changed into /etc a minute earlier. sudo stopped working for everyone, because it refuses to run when its config isn't owned by root, and a couple of services failed on their next restart. I told my lead straight away. I still had that root shell, and because it was a Red Hat family box, rpm's verify mode listed every packaged file whose owner had changed, so I put those back and compared the rest against a second staging server. It took a couple of hours and it was only staging, but it changed how I work. I don't sit in a root shell any more, I use full paths instead of a dot for anything recursive, and my prompt shows the hostname and folder."

Red flag to avoid:

Claiming you've never made a mistake on a server, or a story whose only lesson is 'be more careful'.

They may ask next:
  • How did your team react when you told them?
  • What guardrail would stop a new team member making the same mistake?
Say it in 60 seconds
Were you asked something else? Share it A person checks every question before it goes on the site. No name is shown.
For the call itself

The questions above are the prep. The call has ten more.

ClapAssist is an AI interview assistant for Mac and Windows. It listens to the interview on your computer and shows you what to say, in short lines you can read while you talk. Your resume and notes are never stored on our servers. It stays out of screen share on every plan; only you can see it.

Download ClapAssist with 10 free minutes
Mac and Windows · Stays out of screen share · No card