0

I am trying to check the status of the tcpdump process on Linux inside a python script. (how to use ps cax | grep tcpdump > /dev/null in python or is there any other way?)

1 Answer 1

1

You can use the psutil module

import psutil
process = 'tcpdump'
print([p.info for p in psutil.process_iter(attrs=['pid', 'name']) if process in p.info['name']])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.