Score:5

How can I check which python script is being run given its PID?

cn flag

top is showing that some python script is using all computer resources

Sadly, I have more that one python scrip being running. How can I identify which file it is being run from?

I obtained PID using top command

cn flag
`top -c` will show the full command line, though you may need to make your terminal wider. Pressing `c` when in interactive mode will toggle showing the full command line.
Score:4
cn flag
Kai

You can try reading the file named cmdline in the directory /proc/<PID>/. It is a null-joined list of the program and its arguments. Here is an example on my ubuntu for the process handling unattended-upgrades:

$ cat /proc/133319/cmdline | xargs -0 echo
/usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal

Would that help you with your problem?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.