Hosting Operations
Read-only, can be slowFind the Processes Burning CPU
You need to identify which processes are using the most CPU without changing system state.
Command
ps -eo pid,ppid,stat,pcpu,pmem,comm,args --sort=-pcpu | head -n 10
Before you run this
System impact: Read-only. Can create load on large logs, directories, filesystems, or process tables.
When not to use it: Do not use it as the only signal for long-term performance diagnosis; pair it with uptime and memory checks.
Expected output
A sorted process list with the highest CPU consumers near the top.
System impact
Read-only, can be slow. Nothing changes. The command reads the process table and sorts by CPU use.
Scope this to the smallest useful path or service on busy systems.
Recovery / rollback: no state is changed.
When to use it
Use when load is high or the machine feels slow and you need to find CPU-heavy processes.
When not to use it
Do not use it as the only signal for long-term performance diagnosis; pair it with uptime and memory checks.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ uptime
12:32:44 up 18 days, 3:11, 2 users, load average: 3.91, 2.44, 1.08
$ ps -eo pid,ppid,stat,pcpu,pmem,comm,args --sort=-pcpu | head -n 10
PID PPID STAT %CPU %MEM COMMAND COMMAND
1842 1 R 86.4 4.2 app-worker /srv/app/worker --jobs
1907 1 S 12.8 1.1 nginx nginx: worker process
2011 1 S 4.5 7.9 postgres postgres: checkpointer
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
uptimeps -eo pid,ppid,stat,pcpu,pmem,comm,args --sort=-pcpu | head -n 10
next steps
Related commands
Find the Processes Eating Memory
Memory pressure can look like a slow app, a stuck deploy, or random crashes.
ps -eo pid,ppid,stat,pcpu,pmem,rss,comm,args --sort=-pmem | head -n 10
Find the Processes Using Memory
The server felt slow. Memory pressure was the first thing to rule out.
ps -eo pid,comm,%mem,%cpu --sort=-%mem | head
Find Directories Burning Inodes
Inode cleanup starts by finding the directory with too many files.
find /lab/disk-inode-cleanup/var/cache/app -xdev -type f -printf '%h\n' | sort | uniq -c | sort -nr | head
Find Top 404 URLs
The missing file was not random. The access log had a pattern.
awk '$9==404 {print $7}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | head
Find the Newest Build Logs First
The failing file is usually one of the newest artifacts.
find artifacts logs -type f \( -name '*.log' -o -name '*.txt' \) -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort -r | head
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.