리눅스에서 메모리 사용량을 보는 명령어들.

1. free

# free

실행 예

[root@xxx ~]# free
              total        used        free      shared  buff/cache   available
Mem:        1014548      727124       63300       29336      224124       37804
Swap:       4194300     4038808      155492

2. top

# top -n1 | grep Mem

실행 예

[root@xxx ~]# top -n1 | grep Mem
KiB Mem :  1014548 total,    89956 free,   727076 used,   197516 buff/cache
KiB Swap:  4194300 total,   154628 free,  4039672 used.    51492 avail Mem

3. meminfo

# cat /proc/meminfo | grep Mem

실행 예

[root@xxx ~]# cat /proc/meminfo | grep Mem
MemTotal:        1014548 kB
MemFree:           78344 kB
MemAvailable:      51884 kB

4. 메모리 사용량 많은 순 프로세스 보기 (상위 10개)

# ps -eo user,pid,ppid,rss,size,vsize,pmem,pcpu,time,comm --sort -rss | head -n 11

실행 예

[root@xxx ~]# ps -eo user,pid,ppid,rss,size,vsize,pmem,pcpu,time,comm --sort -rss | head -n 11
USER       PID  PPID   RSS  SIZE    VSZ %MEM %CPU     TIME COMMAND
mysql    10516 23044 143008 1758848 1846496 14.0 1.7 05:34:29 mysqld
apache    5283 21714 74816 426328 1144364  7.3 0.5 01:09:07 httpd
apache   22804 21714 74288 422436 1140472  7.3 0.3 00:40:52 httpd
apache   13757 21714 72580 285308 899728  7.1 0.7 00:52:34 httpd
apache   29439 21714 72260 152552 870560  7.1 0.3 00:07:30 httpd
apache   31022 21714 71752 254996 973004  7.0 0.7 00:48:15 httpd
apache   20054 21714 70388 386368 1104376  6.9 0.6 01:06:43 httpd
apache   20619 21714 69824 320396 934816  6.8 0.6 00:57:03 httpd
apache   19557 21714 69468 224524 836812  6.8 0.8 00:47:03 httpd
apache    8839 21714 64728 177964 893840  6.3 0.9 00:39:52 httpd

+ Recent posts