63

How to display list of running processes Python with full name and active status?

I tried this command: pgrep -lf python

mrid
  • 5,782
  • 5
  • 28
  • 71
MisterPi
  • 1,471
  • 5
  • 17
  • 23
  • just in case you are trying to kill the user's jobs (not roots) that are running pythong this helped me: https://stackoverflow.com/questions/18428750/kill-python-interpeter-in-linux-from-the-terminal/18428847 `pkill -9 python` – Charlie Parker Jul 22 '21 at 17:09

5 Answers5

135

Try this command:

ps -ef | grep python

ps stands for process status

ettanany
  • 19,038
  • 9
  • 47
  • 63
19

ps -aux will give all process grep python

ps -aux | grep python
harshil9968
  • 3,254
  • 1
  • 16
  • 26
14

You could also setup a "watch" in a separate window to constantly monitor Python processes as you run a script: watch -n 1 "ps u -C python3". Particularly useful when developing with multiprocessing.

Jason
  • 719
  • 9
  • 19
2

View 1 shows me all threads of python running, I use this for checking for memory leaks:

View 1

ps -ef | grep [P]ython


#  502 14537 14484   0  5:47PM ttys000    0:00.58 /Library/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python
#  502 14940 14484   0  5:57PM ttys000    0:00.55 /Library/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python

View 2

ps -ef | grep python


#  502 14950 14484   0  5:58PM ttys000    0:00.00 grep python

View 3

ps aux | grep python


# jayrizzo         14957   0.0  0.0 34132060    896 s000  S+    5:58PM   0:00.00 grep python

All 3 variations provide slightly different results.

JayRizzo
  • 3,234
  • 3
  • 33
  • 49
0

Try this command

ps -ef | grep python

ps stands for process status

Drabmaker
  • 1
  • 3