# linux & shell

// [45] real interview questions. Answers and sources live in the practice app.

practice this topic
  1. You get a call: 'the server is SLOW.' Walk through your first five minutes of triage.(mid)
  2. How do you find which process is eating CPU on a Linux box, and dig into what it's doing?(mid)
  3. How do you check overall memory health and find which process consumes the most memory?(mid)
  4. uptime shows 'load average: 1.43, 2.34, 2.78'. What do these numbers mean, and how do you judge whether they're bad?(mid)
  5. Load average is 25 on an 8-core server, but top shows CPUs nearly idle and no process using significant CPU. How is that possible, and how do you find the cause?(senior)
  6. What is the difference between CPU load and CPU utilization?(mid)
  7. Creating a file fails with 'No space left on device', but df -h shows the filesystem only 20% used. What's going on?(mid)
  8. df says the disk is 95% full, but du on the whole mount can't account for the space. You suspect a deleted file. Explain and fix it.(mid)
  9. How do you check disk I/O activity on a Linux system, and what do the key iostat columns mean?(mid)
  10. What's the difference between a hard link and a soft (symbolic) link? What happens to each when the original file is deleted?(junior)
  11. What is a file descriptor? What are file descriptors 0, 1, and 2?(junior)
  12. A service starts failing with 'Too many open files'. How do you diagnose and fix it?(mid)
  13. What signal does plain 'kill PID' send? Explain the practical difference between SIGTERM, SIGKILL, and SIGHUP.(junior)
  14. What exactly happens when you press Ctrl+C in a terminal? Why does it sometimes fail to stop a program?(mid)
  15. What is a zombie process, and how do you get rid of zombies?(mid)
  16. A process is in D state (uninterruptible sleep). Can you kill -9 it? What do you actually do?(senior)
  17. What is 'trap' in shell scripting, and what's a practical use for it?(mid)
  18. What is the Linux OOM killer, when does it strike, and how can you influence which process it picks?(mid)
  19. Every couple of days a certain process silently stops running. How do you investigate why?(mid)
  20. How do you turn an application into a proper systemd service? Sketch the unit file and the key directives.(mid)
  21. On a systemd-based system: how do you start/stop a service, check its status, and view its logs?(junior)
  22. How do you watch a log file as new lines are appended? And what's the difference between tail -f and tail -F?(junior)
  23. What does strace do, and when would you reach for it? How is ltrace different?(mid)
  24. Some unknown process keeps writing to a file — you only know the file's path. How do you find and stop that process?(mid)
  25. Explain setuid, setgid, and the sticky bit. Why is a setuid binary a security concern?(mid)
  26. You try to create a file and it fails. Name at least four distinct reasons this could happen.(mid)
  27. Explain shell I/O redirection: > vs >>, 2>&1, and why 'cmd > file 2>&1' differs from 'cmd 2>&1 > file'.(mid)
  28. How does a shell pipe actually work under the hood, and what is process substitution <(cmd) useful for?(mid)
  29. What are exit codes in the shell? What do 0, 1, 126, 127, and 137 conventionally mean?(mid)
  30. How does cron scheduling work, and what are the classic pitfalls that make a job 'work in my shell but not in cron'?(mid)
  31. How do you run a process in the background, and how do you keep it alive after you log out?(mid)
  32. What is /proc, and what makes it different from other filesystems? Give examples of useful entries.(junior)
  33. How is a new program actually started on Linux? Explain fork() and exec(), and why they are two separate calls.(mid)
  34. A container keeps getting OOM-killed with exit code 137, but 'top' inside the container shows plenty of free memory and the host has RAM to spare. What's going on?(senior)
  35. What are cgroups and namespaces, and how do they together make a 'container'? Which does which?(mid)
  36. A systemd service is in a crash loop — it starts, dies, restarts, dies. systemctl shows it 'activating (auto-restart)' forever. How do you break the loop and find the real cause?(senior)
  37. Disk latency alerts are firing on a database host. Walk through diagnosing whether the disk is actually saturated, what's causing it, and whether it's even a disk problem.(senior)
  38. You need to debug why a container can't reach another service, but the container has no networking tools installed. How do you inspect its network from the host using namespaces?(senior)
  39. Why does PID 1 matter specially in a container, and what breaks if your app runs as PID 1 without being designed for it?(senior)
  40. A program crashed and you want a core dump to debug it, but no core file appears. Walk through enabling core dumps and analyzing one.(mid)
  41. A production incident is blamed on 'ulimits'. What limits actually cause outages, how do you inspect the running process's real limits, and where do you set them correctly?(mid)
  42. Explain how OOM behaves differently inside a container versus on the host, and how memory requests/limits interact with it in an orchestrator.(mid)
  43. How do you actually cap CPU for a process or container, and what's the difference between CPU shares (weight) and CPU quota (limit)?(mid)
  44. What actually happens between typing a command in bash and seeing its output? Trace fork, exec, wait, and how redirection/pipes fit in.(junior)
  45. An application's tail latency spikes periodically but CPU, memory, and disk all look fine on the usual dashboards. What lower-level Linux causes would you investigate?(senior)