你会如何显示像top这样的输出

时间:2014-07-09 12:22:12

标签: python bash python-2.7 python-3.x

我有一个脚本https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py,显示linux中使用的内存,我希望脚本像top一样显示输出,当新进程使用高内存时会自动更改。

我写了一个带有时间延迟的while循环,但仍然没有显示为顶部。

有什么想法吗?

修改:已解决http://techarena51.com/index.php/watch-command-linux/

thx @stark

1 个答案:

答案 0 :(得分:0)

这可以使用bash中的watch命令

来完成

watch commandnamewatch sudo ps_pem.py

watch命令将定期运行命令并显示类似于top的输出。您可以在http://techarena51.com/index.php/watch-command-linux/

查看相同内容
相关问题