# linux & shell
// [45] real interview questions. Answers and sources live in the practice app.
practice this topic- You get a call: 'the server is SLOW.' Walk through your first five minutes of triage.(mid)
- How do you find which process is eating CPU on a Linux box, and dig into what it's doing?(mid)
- How do you check overall memory health and find which process consumes the most memory?(mid)
- 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)
- 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)
- What is the difference between CPU load and CPU utilization?(mid)
- Creating a file fails with 'No space left on device', but df -h shows the filesystem only 20% used. What's going on?(mid)
- 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)
- How do you check disk I/O activity on a Linux system, and what do the key iostat columns mean?(mid)
- What's the difference between a hard link and a soft (symbolic) link? What happens to each when the original file is deleted?(junior)
- What is a file descriptor? What are file descriptors 0, 1, and 2?(junior)
- A service starts failing with 'Too many open files'. How do you diagnose and fix it?(mid)
- What signal does plain 'kill PID' send? Explain the practical difference between SIGTERM, SIGKILL, and SIGHUP.(junior)
- What exactly happens when you press Ctrl+C in a terminal? Why does it sometimes fail to stop a program?(mid)
- What is a zombie process, and how do you get rid of zombies?(mid)
- A process is in D state (uninterruptible sleep). Can you kill -9 it? What do you actually do?(senior)
- What is 'trap' in shell scripting, and what's a practical use for it?(mid)
- What is the Linux OOM killer, when does it strike, and how can you influence which process it picks?(mid)
- Every couple of days a certain process silently stops running. How do you investigate why?(mid)
- How do you turn an application into a proper systemd service? Sketch the unit file and the key directives.(mid)
- On a systemd-based system: how do you start/stop a service, check its status, and view its logs?(junior)
- How do you watch a log file as new lines are appended? And what's the difference between tail -f and tail -F?(junior)
- What does strace do, and when would you reach for it? How is ltrace different?(mid)
- Some unknown process keeps writing to a file — you only know the file's path. How do you find and stop that process?(mid)
- Explain setuid, setgid, and the sticky bit. Why is a setuid binary a security concern?(mid)
- You try to create a file and it fails. Name at least four distinct reasons this could happen.(mid)
- Explain shell I/O redirection: > vs >>, 2>&1, and why 'cmd > file 2>&1' differs from 'cmd 2>&1 > file'.(mid)
- How does a shell pipe actually work under the hood, and what is process substitution <(cmd) useful for?(mid)
- What are exit codes in the shell? What do 0, 1, 126, 127, and 137 conventionally mean?(mid)
- How does cron scheduling work, and what are the classic pitfalls that make a job 'work in my shell but not in cron'?(mid)
- How do you run a process in the background, and how do you keep it alive after you log out?(mid)
- What is /proc, and what makes it different from other filesystems? Give examples of useful entries.(junior)
- How is a new program actually started on Linux? Explain fork() and exec(), and why they are two separate calls.(mid)
- 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)
- What are cgroups and namespaces, and how do they together make a 'container'? Which does which?(mid)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- Explain how OOM behaves differently inside a container versus on the host, and how memory requests/limits interact with it in an orchestrator.(mid)
- 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)
- What actually happens between typing a command in bash and seeing its output? Trace fork, exec, wait, and how redirection/pipes fit in.(junior)
- 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)