Interview Questions/Phone Screen/Find Top CPU Processes in Linux
BeginnerPhone
1 min

Find Top CPU Processes in Linux

LinuxTroubleshootingSystem Administration
Advertisement
Interview Question

How do you quickly identify which processes are consuming the most CPU on a Linux server?

Key Points to Cover
  • Use `top` or `htop` to sort by CPU
  • `ps -eo pid,comm,%cpu --sort=-%cpu | head` for a quick list
  • Optionally check load with `uptime`/`vmstat`
Evaluation Rubric
Mentions top/htop or ps50% weight
Shows sorting/quick listing30% weight
Mentions load/context commands20% weight
Hints
  • 💡Sorting in top: press Shift+P.
Common Pitfalls to Avoid
  • ⚠️Failing to mention `top` or `htop` as primary interactive tools for real-time monitoring.
  • ⚠️Not explaining *how* to sort by CPU in `top` (e.g., mentioning the 'P' key).
  • ⚠️Providing a generic `ps` command without specific output columns or proper sorting (`ps aux` instead of `ps -eo ... --sort=-%cpu`).
  • ⚠️Overlooking the importance of checking overall system load (e.g., `uptime`) for contextual understanding.
  • ⚠️Suggesting overly complex or less common diagnostic tools when the question asks for *quick* identification.
Potential Follow-up Questions
  • How do you map PID to service?
  • What about per-CPU usage?
Advertisement