Operating System - HP-UX
1752802 Members
5700 Online
108789 Solutions
New Discussion юеВ

Re: How to get status of 2 process only

 
SOLVED
Go to solution
John Ferro
Regular Advisor

How to get status of 2 process only

Hi,

Which option i should use with ps command to know the status of 2 processes only?

Regards,
11 REPLIES 11
rana sarkar
Advisor

Re: How to get status of 2 process only

Do
ps -exlf| grep -ie
Jozef_Novak
Respected Contributor

Re: How to get status of 2 process only

# ps -ef | grep -e -e
Dennis Handly
Acclaimed Contributor

Re: How to get status of 2 process only

UNIX95=EXTENDED_PS ps -f -p PID1 -p PID2
UNIX95=EXTENDED_PS ps -f -C name1 -C name2
John Ferro
Regular Advisor

Re: How to get status of 2 process only

Hi

Rana i didn't get your command well,

could you pls. clear it.
John Ferro
Regular Advisor

Re: How to get status of 2 process only

Hi Jozef

I tried your command but it prints all processes not the grep processes.
Matti_Kurkela
Honored Contributor
Solution

Re: How to get status of 2 process only

Or simply

ps -fp PID1,PID2

Note: use the comma as a separator between the PID numbers, not spaces.

MK
MK
Ganesan R
Honored Contributor

Re: How to get status of 2 process only

Hi John,

#ps -ef |egrep '(PID1|PID2)'

or

#ps -fp PID1,PID2
Best wishes,

Ganesh.
Jozef_Novak
Respected Contributor

Re: How to get status of 2 process only

Hello John,

that's strange. I tried to grep for diag and bash processes and it works:

root@vl1:(/)#ps -ef | grep -e diag -e bash
root 2147 2128 0 22:39:49 console 0:00 bash
root 1712 1 0 22:39:06 ? 0:01 /usr/sbin/stm/uut/bin/sys/diagmond
root 2494 1712 0 22:49:36 ? 0:00 diaglogd
root 25575 25278 0 13:46:59 pts/0 0:00 grep -e diag -e bash
novakj 25242 25240 0 13:34:34 pts/0 0:00 -bash
root 25278 25262 0 13:34:40 pts/0 0:00 bash


Jozef
John Ferro
Regular Advisor

Re: How to get status of 2 process only

Hi,

I tried ps -fp PID1,PID2 it works fine, but also i need to use by process name as process id could be changed. so could you provide me command to check process with 2 or 3 process names, not ID?