How Can I Tell If Python Script Is Running on Linux?
Contents

I usually use ps -fA | grep python to see what processes are running. The CMD will show you what python scripts you have running, although it won’t give you the directory of the script.

How do I know if a python file is running?

“python check if a program is running” Code Answer’s

  1. #Iterates through all the programs running in your system and checks for the one in the string.
  2. import psutil.
  3. “someProgram” in (p. name() for p in psutil. process_iter())

How do you check the status of a script in Linux?

Linux command to check if a shell script is running or not

  1. ps -ae shows the scriptname for me. – nims May 30 ’13 at 4:40.
  2. ps aux|grep scriptname or pgrep scriptname – Basile Starynkevitch May 30 ’13 at 4:40.
  3. Or pidof to just get the PID. – tripleee May 30 ’13 at 5:12.
Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest