Back to commands

Hosting Operations

Read-only, can be slow

Find the Processes Eating Memory

The server is slow, swap may be active, or processes are getting killed, and you need to see which processes have the largest resident memory footprint.

Command

ps -eo pid,ppid,stat,pcpu,pmem,rss,comm,args --sort=-pmem | 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 whole memory diagnosis. Pair it with `free -h`, swap activity, and recent service logs before restarting anything.

Expected output

A process list sorted by memory percentage, with RSS shown so resident memory stands out from vague percent-only readings.

System impact

Read-only, can be slow. Nothing changes. The command reads process metadata and sorts by memory percentage; it may reveal process arguments, so avoid sharing raw output carelessly.

Scope this to the smallest useful path or service on busy systems.

Recovery / rollback: no state is changed.

When to use it

Use after checking overall memory pressure, or when one service is suspected of leaking memory.

When not to use it

Do not use it as the whole memory diagnosis. Pair it with `free -h`, swap activity, and recent service logs before restarting anything.

next steps

Related commands

Hosting Operations Can be slow

Find the Processes Burning CPU

A server feels slow, but you need proof before restarting anything.

ps -eo pid,ppid,stat,pcpu,pmem,comm,args --sort=-pcpu | head -n 10
Linux Survival Basics Can be slow

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
Linux Survival Basics Can be slow

Show Top Memory Processes

Find current memory owners before restarting workloads.

ps -eo pid,comm,%mem,%cpu --sort=-%mem | head
Hosting Operations Read-only

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
Hosting Operations Can be slow

Find the Largest CI Artifacts

A bloated artifact can explain a slow or failed pipeline.

find artifacts -type f -printf '%s %p\n' | sort -nr | head -10
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.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.