Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to find top process and identify the PID.

Alok_Behria
Advisor

Need to find top process and identify the PID.

 

Hi All,

 

OS :- ptmsap> uname -a
HP-UX tbx4 B.11.11 U 9000/800 3251073457

 

I need to find out the top process consuming CPU and memory. I am using following command to find the top consuming process, but it's failing for some reason. I am using this command referred in one of the oracle book.

also, I would also appriciate , if you could describe each parameter passing to whole command.

 

ps -e pcpu,pid,user,tty,args | sort -n -k 1 -r | head

 

3 REPLIES
Highlighted
Dennis Handly
Acclaimed Contributor

Re: Need to find top process and identify the PID.

>I am using following command to find the top consuming process, but it's failing for some reason. I am using this command referred in one of the oracle book.

 

This isn't valid for HP-UX, or there are a few things missing:

UNIX95=EXTENDED_PS ps -e -opcpu,pid,user,tty,args | sort -n -r -k1,1 | head

 

UNIX95= enables -o;  -e every PID; -o only those fields

sort: -n numeric, -r reverse, -k key 1

Alok_Behria
Advisor

Re: Need to find top process and identify the PID.

 

Dannies, thank for offering your inputs on this. I was thinking of if that command is not suitable for HPUX , how could I able to see top process on machine consuming the highest cpu cycles ? would also appreciate, along with the command , you describe each and every flag. Thanks once again for your inputs.

Dennis Handly
Acclaimed Contributor

Re: Need to find top process and identify the PID.

> thinking of if that command is not suitable for HP-UX

 

My corrected version works in a real shell.