Linux Survival Basics
Read-only, can be slowFind the Processes Using Memory
You need a quick process-level view of memory usage.
Command
ps -eo pid,comm,%mem,%cpu --sort=-%mem | head
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 kill a process just because it uses memory; understand its role first.
Expected output
A process table sorted by memory usage.
System impact
Read-only, can be slow. Nothing changes. The command lists processes sorted by memory percentage.
Scope this to the smallest useful path or service on busy systems.
Recovery / rollback: no state is changed.
When to use it
Use this before killing processes or resizing a VPS.
When not to use it
Do not kill a process just because it uses memory; understand its role first.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ ps -eo pid,comm,%mem,%cpu --sort=-%mem | head
PID COMMAND %MEM %CPU
14 ps 0.0 0.0
1 bash 0.0 33.3
13 bash 0.0 0.0
12 timeout 0.0 0.0
15 head 0.0 0.0
$ free -h
total used free shared buff/cache available
Mem: 125Gi 42Gi 6.3Gi 292Mi 75Gi 83Gi
Swap: 0B 0B 0B
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 25G 19G 5G 80% /work
tmpfs 64M 0 64M 0% /dev
shm 64M 0 64M 0% /dev/shm
tmpfs 64M 8.0K 64M 1% /tmp
tmpfs 64M 352K 64M 1% /var
/dev/vda1 25G 19G 5G 80% /work
tmpfs 63G 0 63G 0% /proc/asound
tmpfs 63G 0 63G 0% /proc/acpi
tmpfs 63G 0 63G 0% /proc/scsi
tmpfs 63G 0 63G 0% /sys/firmware
tmpfs 63G 0 63G 0% /sys/devices/virtual/powercap
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
ps -eo pid,comm,%mem,%cpu --sort=-%mem | headfree -hdf -h
next steps
Related commands
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
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
Check Memory Pressure with free
Linux memory numbers look scary until you know which column matters.
free -h
Check Memory Pressure Quickly
See whether memory is actually tight before restarting services.
free -h
Spot OOM Kills in the Kernel Journal
Exit code 137 often means the kernel has something to say.
journalctl -k --since "2 hours ago" --no-pager -o short-iso | grep -Ei 'out of memory|oom|killed process'
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.