Site icon New Generation Enterprise Linux

Catch the exact process killing your RAM before the OOM killer does

Process & Resource Monitoring (Top/Htop/Ps/Systemd)

Catch the exact process killing your RAM before the OOM killer does

đź§© The Challenge

You know that feeling when the server starts swapping, the ssh connection freezes, and you just know the OOM killer is about to axe your database? Watching htop feels like trying to read a license plate on a speeding car while your own terminal is hanging.

đź’ˇ The Fix

Use ps to grab a sorted list of memory-hungry processes while the machine is still responsive enough to actually run a command. It gives you a clean, non-interactive snapshot that won’t die just because the memory pressure is spiking.

ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 10

⚙️ Why It Works

By sorting by memory percentage descending and piping to head, you instantly see the top ten memory hogs without the overhead of a full dashboard refresh. Using the process flag e allows you to see everything running on the system, which is usually exactly what you need when the box is choking.

🚀 Pro-Tip: Alias this to something like memhog in your bashrc so you aren’t hunting for the flags when the pressure is on.

Linux Tips & Tricks | © ngelinux.com | 8/15/2026

0 0 votes
Article Rating
Exit mobile version