Skip to content

Bash Snippet: Monitor Process Memory Usage

2010 November 10
by Tedb0t

Here’s a neat Bash one-liner:

ps aux | grep -E '[l]ighttpd|[m]ain.py'

This returns your process list with memory columns (RSS & VSZ) filtered by multiple names. Now you could make a little script to put in a cron job to log memory usage:

#!/usr/bin/env bash
ps aux | grep -E '[l]ighttpd|[m]ain.py' >> mem.log

Not very fancy and not the easiest to read, but it will do in a pinch.

Related Posts:


Comments are closed.