Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Find System Hogs and Child Processes

June 25, 2023 — Gregg Szumowski

There are a lot of tools out there that can help you to do this that are both GUI or command line-based but sometimes you’re on a production server that may have limited tools and sometimes the simplest tools are best in cases like this.

List the processes that are not owned by you that are using a lot of CPU:

$ ps aux --sort=-%cpu | grep -m 8 -vwhoami

or by memory:

$ ps aux --sort=-%mem | grep -m 8 -vwhoami

or by longest running process:

$ ps aux --sort=-time | grep -m 8 -vwhoami

List processes by a specific user:

$ ps -U gszumo

or multiple users:

$ ps -U gszumo -U katy

You can see child proceses:

$ ps -eo pid,args --forest

or children of a specific process:

$ ps -f --ppid 4775

I don’t remember where I found these tips but they have come in handy on many occasions and I am documenting them here hoping that readers (whatever few there are) will also benefit from them.

Tags: cli, ps, processes, motd