
processInfo.py
import commands, os, string
import commands, os, string
program = raw_input(“Enter the name of the program to check: “)
try:
#perform a ps command and assign results to a list
output = commands.getoutput(“ps -f|grep ” + program)
proginfo = string.split(output)
#display results
print “n
Full path:tt”, proginfo[5], “n
Owner:ttt”, proginfo[0], “n
Process ID:tt”, proginfo[1], “n
Parent process ID:t”, proginfo[2], “n
Time started:tt”, proginfo[4]
except:
print “There was a problem with the program.”