通过PID在MiB / KiB中使用内存

时间:2017-06-07 18:00:57

标签: bash shell

我需要命令通过PID获取MiB或KiB中的进程内存使用情况。我更喜欢我在gnome-system-monitor中看到的数字" Memory"柱。我尝试了很多不同的命令,但所有命令都给了我一些其他的数字。

例如,我尝试使用不同的密钥ps。最有趣的是 ps aux。 RSS列很接近,但这里的数字大于gnome-system-monitor。许多类似于我的问题的答案包含top命令,但它以百分比形式提供内存使用量。

1 个答案:

答案 0 :(得分:0)

cat /proc/YourPid/status

ps aux YourPid

top -p YourPid

pmap -x YourPid

所有这些都提供进程内存使用; top给出百分比和绝对值(RES - 居民大小)

查看Understanding Process memoryHow to measure actual memory usage of an application or process?,了解有关内存使用情况和监控的详细信息。