I want to get PIDs of two or more processes using "pgrep" command in Linux.
As we know pgrep syntax is
pgrep [options] <pattern>
Here is a hypothetical command which should return PIDs of two processes whose names are process1 and process2 respectively.
pgrep process1 OR process2
What should be the pattern that needs to be used to achieve the above?
man pgrep
:pgrep [options] pattern
andpattern: Specifies an Extended Regular Expression for matching against the process names or command lines.
– Countercheck