Tag Archives: Problem Description Suppose

How to remove listing of current user cmd from ps -ef listing?

By KDMishra

Hi All,

Could you please help to resolve my following issues:

Problem Description:

Suppose my user name is “MI90”.
i.e. $USER = MI90

when i run below command, i get all the processes running on the system containing name MQ.

ps -ef | grep MQ

But sometimes it lists “grep MQ” cmd also in its output, which is nothing but the above cmd which i executed to check all the running processes of system.
& sometimes not.

NEED:

My need is that it should always avoid listing “grep MQ“, which has been started just now by the current user i.e. MI90

Examples:

when i run $ ps -ef | gre MQ

i got :

MI90 36241614 36110452 0 05:41:31 pts/2 0:00 grep MQ
tibco 38535330 1 0 02:05:18 – 0:11 /appl/tibco/adapter/admqs/6 .2/bin/admqs –pid –run –propFile /appl/tibco/tra/domain/PR/application/MQAdap ter/MQAdapter-ABNAMROMQAdapter.tra –innerProcess
tibco 38797444 1 1 02:05:18 – 0:11 /appl/tibco/adapter/admqs/6 .2/bin/admqs –pid –run –propFile /appl/tibco/tra/domain/PR/application/MQAdap terNew/MQAdapterNew-ABNAMROMQAdapterNew.tra –innerProcess

but i always need only below:

tibco 38535330 1 0 02:05:18 – 0:11 /appl/tibco/adapter/admqs/6 .2/bin/admqs –pid –run –propFile /appl/tibco/tra/domain/PR/application/MQAdap ter/MQAdapter-ABNAMROMQAdapter.tra –innerProcess
tibco 38797444 1 1 02:05:18 – 0:11 /appl/tibco/adapter/admqs/6 .2/bin/admqs –pid –run –propFile /appl/tibco/tra/domain/PR/application/MQAdap terNew/MQAdapterNew-ABNAMROMQAdapterNew.tra –innerProcess

So please help me in getting such o/p….

Thanks in advance!
Regards,
KD

Source: FULL ARTICLE at The UNIX and Linux Forums