I have one application and multiple instances of the same application are running in the system. Every instance of the application is invoked with different argument.
I want to get the pid of a particular process which had been invoked with some argument i.e. pid of particular instance of the application according to the argument passed.
Is there any way to get it?
I have one application and multiple instances of the same application are running in
Share
I would probably check output of
ps -eo pid,argsand grep for the parameters I need and then cut the pid from the beginning of the output:ps -eo pid,args | grep --parameter=x | cut -c 1-5Check man page of grep. There are a lot of (somewhat confusing) options that will allow you shape the output of the command. In the above example
-eselects all the processes to be shown and-olets user to choose what to output.