背景
两个不同版本的linux,A、B想对比进程的内存使用
A能直接用ps -aux查看,B没有对应参数,报错如下:
在A走一波ps的help
ps --help
在B走一波ps的help
ps --help
可以看出来是有区别的,能看到B是支持-o参数的,随便写一个命令
ps -o lzy
看得出-o后面支持的参数,看到了熟悉的几个老朋友,例如pid,rss
ps -o pid,rss
在A试试用
ps --help o
可以看出,也是用-o命令的,只不过没有打印详细的参数
A可以执行的命令,感觉和ps -aux差不多
ps -eo pid,ppid,%mem,rss,%cpu,command --sort=-%cpu | head
参考博文
https://zhuanlan.zhihu.com/p/532442482
https://www.runoob.com/linux/linux-comm-ps.html