title: Find out details of the script associated with PID
body: <p>By using the <code>top</code> command, I can see the processes running on my server:</p>
  
  <p><a href="https://i.stack.imgur.com/Vztax.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vztax.png" alt="enter image description here"></a></p>
  
  <p>I have noticed that R and postgres are always using a considerable amount of CPU.  </p>
  
  <p>How does one reveal the actual query or script that is associated with the PID taking up so much CPU?  What command should one use in the terminal? </p>