in reply to How to get the process Id

You may be helped by a simple killall tcpdump, if yours is the only tcpdump running on the machine.

Otherwise, you may need to write a little wrapper program around the tcpdump command to fork and 1) In the parent get the pid (it's the return value from fork) and store it somewhere; 2) In the child exec() the tcpdump.

HTH, M4