Back to commands

Linux Survival Basics

Read-only

Check Memory Pressure Quickly

A VPS feels slow, and people often restart daemons before checking whether memory pressure is the cause.

Command

free -h

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not use it to identify which process is responsible; follow up with ps, top, or systemd-cgtop.

Expected output

A memory table with total, used, free, buff/cache, and available columns.

System impact

Read-only. Nothing changes. free prints total, used, free, shared, buff/cache, and available memory.

Recovery / rollback: no state is changed.

When to use it

Use during slowdowns, deploy validation, memory alerts, or before resizing a VPS.

When not to use it

Do not use it to identify which process is responsible; follow up with ps, top, or systemd-cgtop.

next steps

Related commands

Linux Survival Basics Can be slow

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

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
Hosting Operations Read-only

Snapshot Container CPU and Memory

Get Docker resource usage once, without leaving a live dashboard running.

docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}'
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
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

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