1

I have a number of scripts and processes that fire them on an Ubuntu server. Using top indicates that python is executing something, but there's no way of telling which script is being executed with the output from top unless i'm mistaken.

Is there a way to check the path to the script file(s) currently being executed by the python interpreter?

R2Bleep2
  • 77
  • 1
  • 7
  • 1
    what @Fraser said in the reply but also https://stackoverflow.com/questions/564695/is-there-a-way-to-change-effective-process-name-in-python might help.. – rasjani Aug 25 '23 at 11:45
  • Stack Overflow is only for questions about software development or tools exclusive to that use. Distinguishing between `python foo` and `python bar` in the output of `top` is no different from distinguishing between `vim foo.txt` and `vim bar.txt`; it's not specific to software development and so is a better fit for [unix.se] or [Super User](https://superuser.com/). – Charles Duffy Aug 25 '23 at 15:14
  • 1
    And yet it's useful to developers. Thank you @Fraser – R2Bleep2 Aug 29 '23 at 08:47

1 Answers1

1

You can just pass the -c flag to see command line.

e.g.

top -c

   1 root      20   0  165828  11024   8180 S   0.0   0.0   0:00.20 /sbin/init
   2 root      20   0    2324   1192   1084 S   0.0   0.0   0:00.00 /init
   5 root      20   0    2352     80     68 S   0.0   0.0   0:00.00 plan9 --control-socket 6 --log-level 4 --server-fd 7 --pipe-+ 

Alternatively you can use htop which gives much more information.

Fraser
  • 15,275
  • 8
  • 53
  • 104