mahmood mahmood - 3 months ago 5x
Linux Question

finding the process numbers of a multithread application

How can I retrieve the process numbers of a issued multithread application? I mean, I am looking for a bash script that after executing a command, puts the process numbers in a list. For example:

./run_program -nt 4
# find the list of PIDs


I would use pgrep for checking the process ids.

If you're only looking at child PID of the current process, you can use the -P option:

pgrep -P $$