linux 显示进程内存使用情况

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5039240/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 02:54:04  来源:igfitidea点击:

linux show process ram usage

linux

提问by user121196

free shows that My centos system used 4/11 Gb RAM, but I can't pinpoint which process has used them. I used top, however it only shows one process(mysqld) used about 1GB. what's going on?

free 显示我的 centos 系统使用了 4/11 Gb RAM,但我无法确定哪个进程使用了​​它们。我使用了 top,但是它只显示一个进程(mysqld)使用了大约 1GB。这是怎么回事?

# free -g
             total       used       free     shared    buffers     cached
Mem:            11          4          7          0          0          3
-/+ buffers/cache:          0         11
Swap:            1          0          1

sks:  91 total,   1 running,  90 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.1%sy,  0.0%ni, 99.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  12299928k total,  4372572k used,  7927356k free,    77392k buffers
Swap:  2097144k total,        0k used,  2097144k free,  3925252k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 18 0 10352 704 588 S 0.0 0.0 0:00.82 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.01 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.01 migration/1
5 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1
6 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/2
7 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/2
8 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/3
9 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/3
10 root 10 -5 0 0 0 S 0.0 0.0 0:00.09 events/0
11 root 10 -5 0 0 0 S 0.0 0.0 0:00.01 events/1
12 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/2
13 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/3
14 root 10 -5 0 0 0 S 0.0 0.0 0:00.01 khelper
119 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
126 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/0
127 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/1
128 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/2
129 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/3
130 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
292 root 14 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/0
293 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/1
294 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/2
295 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/3
298 root 14 -5 0 0 0 S 0.0 0.0 0:00.00 khubd
300 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kseriod
390 root 15 0 0 0 0 S 0.0 0.0 0:00.00 khungtaskd
393 root 17 -5 0 0 0 S 0.0 0.0 0:00.00 kswapd0
394 root 17 -5 0 0 0 S 0.0 0.0 0:00.00 aio/0
395 root 18 -5 0 0 0 S 0.0 0.0 0:00.00 aio/1
396 root 18 -5 0 0 0 S 0.0 0.0 0:00.00 aio/2
397 root 17 -5 0 0 0 S 0.0 0.0 0:00.00 aio/3
603 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kpsmoused
671 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 mpt_poll_0
672 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 mpt/0
673 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0
679 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 ata/0
680 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 ata/1
681 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 ata/2
682 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 ata/3
683 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 ata_aux
694 root 14 -5 0 0 0 S 0.0 0.0 0:00.00 kstriped
715 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 ksnapd
753 root 10 -5 0 0 0 S 0.0 0.0 0:03.54 kjournald
778 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kauditd
811 root 19 -4 12668 836 400 S 0.0 0.0 0:00.53 udevd
2331 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kmpathd/0
2332 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 kmpathd/1
2334 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 kmpathd/2
2335 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 kmpathd/3
2336 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 kmpath_handlerd
2358 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kjournald
2899 root 15 0 0 0 0 S 0.0 0.0 0:00.00 vmmemctl
3028 root 15 0 17540 1292 1052 S 0.0 0.0 0:01.31 vmware-guestd
3374 root 11 -4 28220 816 584 S 0.0 0.0 0:00.02 auditd
3376 root 7 -8 16268 764 620 S 0.0 0.0 0:00.01 audispd
3396 root 15 0 5912 672 544 S 0.0 0.0 0:00.06 syslogd
3399 root 15 0 3808 428 348 S 0.0 0.0 0:00.01 klogd
3413 root 18 0 10764 372 244 S 0.0 0.0 0:00.29 irqbalance
3428 dbus 18 0 32712 1404 856 S 0.0 0.0 0:00.00 dbus-daemon

3477 haldaemo 15 0 49164 5152 2224 S 0.0 0.0 0:00.91 hald
3478 root 15 0 21700 1056 872 S 0.0 0.0 0:00.01 hald-runner
3485 haldaemo 19 0 12328 860 744 S 0.0 0.0 0:00.00 hald-addon-acpi
3491 haldaemo 17 0 12328 852 740 S 0.0 0.0 0:00.00 hald-addon-keyb
3500 root 16 0 10232 688 592 S 0.0 0.0 0:02.94 hald-addon-stor
3519 nscd 15 0 199m 2044 1364 S 0.0 0.0 0:00.15 nscd
3542 root 15 0 60748 1196 648 S 0.0 0.0 0:00.00 sshd
3561 ntp 15 0 19832 5528 4424 S 0.0 0.0 0:00.03 ntpd
3576 root 25 0 64168 1320 1056 S 0.0 0.0 0:00.19 mysqld_safe
3601 root 15 0 73812 1052 492 S 0.0 0.0 0:00.01 crond
3714 xfs 18 0 18416 744 480 S 0.0 0.0 0:00.00 xfs
3799 root 18 0 17068 448 304 S 0.0 0.0 0:00.00 atd
3923 root 25 0 58876 316 240 S 0.0 0.0 0:00.00 rhnsd
3942 root 17 0 3796 492 420 S 0.0 0.0 0:00.00 mingetty
3945 root 15 0 3796 488 420 S 0.0 0.0 0:00.00 mingetty
3948 root 18 0 3796 488 416 S 0.0 0.0 0:00.00 mingetty
3950 root 18 0 3796 488 416 S 0.0 0.0 0:00.00 mingetty
3951 root 18 0 3796 484 416 S 0.0 0.0 0:00.00 mingetty
3956 root 18 0 3796 488 416 S 0.0 0.0 0:00.00 mingetty

采纳答案by shellholic

Reading your free, there is 3GB used as disk cache.

阅读您的free,有 3GB 用作磁盘缓存。

回答by Drakosha

  1. You can sort the processes by used memory by pressing Mwhen in top.
  2. Linux uses unused memory as a disk cache, it's normal behavior.
  1. 您可以按M在顶部时按使用的内存对进程进行排序。
  2. Linux 使用未使用的内存作为磁盘缓存,这是正常行为。

回答by Pavan Yalamanchili

If you want a more visual (yet command line) tool, htop would be a good idea. You can sort them by various options.

如果你想要一个更直观(但命令行)的工具,htop 将是一个好主意。您可以按各种选项对它们进行排序。

回答by dogbane

pshas options for this.

ps有这方面的选择。

e.g. ps -euf

例如 ps -euf

or

或者

ps -e -orss=,size=,args= | sort -b -n

rssresident set size size
sizememory size in kilobytes

rss常驻集大小大小
大小内存大小以千字节为单位

回答by Underverse

gnome-system-monitorshows a visual representation of processes, % CPU, ID, and memory currently in use.

gnome-system-monitor显示当前使用的进程、CPU 百分比、ID 和内存的可视化表示。