Measure which process consumes CPU and act fast on performance issues. 01.12.2025 | reading time: 3 min On a busy system you must know which process steals CPU time; this short guide shows how to find and quantify per-process CPU usage with common command-line tools. Spot a runaway process Run this one-liner to list the top CPU consumers and inspect the suspect immediately: ```bash $ ps aux --sort=-%cpu | head -n 6 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2345 42.3 1.2 123456 7890 ? R 10:01 1:23 /usr/bin/heavy-service www-data 6789 5.1 0.4 65432 4321 ? S 09:58 0:02 /usr/sbin/worker ``` The first column shows the user, `PID` the process id, and `%CPU` the instant share of CPU at sample time. Measure over time A single sample can mislead; sample repeatedly with `pidstat` to see trends: ```bash $ pidstat -u 1 5 Linux 5.x... _x86_64_ (4 CPU) 01:00:00 AM UID PID %usr %system %guest %CPU CPU Command 01:00:01 AM 0 2345 42.00 0.00 0.00 42.00 0 heavy-service 01:00:02 AM 0 2345 10.00 0.00 0.00 10.00 1 heavy-service ``` This shows CPU usage per process across seconds, exposing spikes and steady loads. Look deeper: threads and cgroups To see per-thread CPU usage use `ps -L -p PID -o tid,%cpu,comm` or `top -H -p PID`; to limit or attribute CPU to services use cgroups or `systemd-cgtop`; remember that a process can show more than 100 percent on multicore systems when it uses multiple cores. When to pick which tool Use `ps` for quick snapshots, `top` or `htop` for interactive monitoring, `pidstat` for time-series sampling and `perf` when you need CPU hotspots inside functions; choose based on whether you need a single check, continuous observation or deep profiling. Next steps Now that the culprit is visible, decide: kill or throttle, change affinity with `taskset`, or migrate work into a cgroup; learn to script these checks and build alerts to prevent repeats, and consider study paths like CompTIA Linux+ or LPIC-1 with intense exam preparation at bitsandbytes.academy to formalize this skill. Join Bits & Bytes Academy First class LINUX exam preparation. processes utilities troubleshooting