Splitting out the output of ps using Python

后端 未结 5 1110
轻奢々
轻奢々 2020-11-30 07:58

On Linux, the command ps aux outputs a list of processes with multiple columns for each stat. e.g.

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START          


        
5条回答
  •  我在风中等你
    2020-11-30 08:46

    Why don't you use PSI instead? PSI provides process information on Linux and other Unix variants.

    import psi.process
    for p in psi.process.ProcessTable().values(): …
    

提交回复
热议问题