Problem Statement
How do you identify which process is consuming the most CPU and memory?
Explanation
Use top or htop to monitor real-time CPU and memory usage.
Sort by CPU or memory to identify heavy processes. You can also use ps aux --sort=-%mem | head to list the top memory consumers.
Code Solution
SolutionRead Only
ps aux --sort=-%cpu | head
Practice Sets
This question appears in the following practice sets: