Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get to know which script a python process is running? [duplicate]

Tags:

python

linux

Possible Duplicate:
Finding the command for a specific PID in Linux from Python

I currently have a python process (and its pid, of course) and I wondered if it is possible to find out which script this process is running. (I use Ubuntu Linux 10.04.4 LTS)

like image 815
Martin Thoma Avatar asked Oct 01 '12 10:10

Martin Thoma


1 Answers

cat /proc/${pid}/cmdline | tr '\0' ' '

The cmdline pseudo-file contains a process's command line arguments as a NUL-separated list of strings. The tr command translates the NULs to spaces.

like image 146
Fred Foo Avatar answered Oct 28 '22 17:10

Fred Foo