This is a simple cheat sheet, only containing stuff I've used before. See https://psutil.readthedocs.io/en/latest/ for full docs {{{c import psutil print(psutil.pids()) # get list of pids # this is the preferred method for iterating over pids # (i.e. don't iterate over the list returned by psutil.pids() ) for proc in psutil.process_iter(): # proc is a psutil.Process # (note pid is an attribute, not a method) proc.pid proc.name() proc.cmdline() }}}%TIME=1618874233