7. free

안녕하세요, MJ 입니다.


리눅스 시스템의 메모리 정보를 확인하기위해 free 명령어를 사용 할 수 있습니다.


free 명령어에 대해 알아보겠습니다.

 

[free 명령어 결과]

[root@run-linux ~]# free               total        used        free      shared  buff/cache   available
Mem:         3747544      352632     3416564        8748      200580     3394912
Swap:        2097148           0     2097148

===> free 명령어 결과로 키로바이트 단위로 확인합니다.
[root@run-linux ~]# free -m
               total        used        free      shared  buff/cache   available
Mem:            3659         344        3336           8         195        3315
Swap:           2047           0        2047

===> free 명령어 결과로 메가바이트 단위로 확인합니다.
[root@run-linux ~]# free -g
               total        used        free      shared  buff/cache   available
Mem:               3           0           3           0           0           3
Swap:              1           0           1

===> free 명령어 결과로 기가바이트 단위로 확인합니다.
[root@run-linux ~]# free -h
               total        used        free      shared  buff/cache   available
Mem:           3.6Gi       344Mi       3.3Gi       8.0Mi       195Mi       3.2Gi
Swap:          2.0Gi          0B       2.0Gi

===> free 명령어 결과를 사람이 읽기 편한 단위로 확인합니다.

 

<free 명령어 결과 설명>

total현재 시스템에 설치되어있는 전체 메모리의 크기.
used현재 사용 중인 메모리 크기를 나타낸다. (total - free - buffer/cache)
free시스템에서 사용 가능한 잔여 메모리의 크기를 나타낸다. 즉, 사용되지 않은 메모리의 양으로 커널 또는 애플리케이션이 사용 가능하다.
shared프로세스 사이에서 공유되는 메모리의 크기이다. 주로 프로세스 또는 스레드 간 통신에 사용된다.
man을 통해 설명을 확인하면 tmpfs에서 사용되는 메모리로 나와있다. 이는 top 명령어에서의 shr과 다르다.(top에서의 shr은 공유되는 라이브러리 등이 올라와있는 메모리를 말한다)
buffer / cache커널이 IO성능 향상을 위해 캐시 영역으로 사용하는 메모리의 크기이다. buffer는 Buffer cache의 크기를 나타내며, cache는 Page cache + slabs의 크기이다.
availablecentos7에 들어서면서 기존에 존재하던 -/+ buffer/cache 부분이 제거되고 생겨났다. 해당 설명을 man으로 확인하면 아래와 같다.

buffer/cache 설명(새창으로 열립니다)


도움말
[root@run-linux ~]# free --help

Usage:
 free [options]

Options:
 -b, --bytes         show output in bytes
     --kilo          show output in kilobytes
     --mega          show output in megabytes
     --giga          show output in gigabytes
     --tera          show output in terabytes
     --peta          show output in petabytes
 -k, --kibi          show output in kibibytes
 -m, --mebi          show output in mebibytes
 -g, --gibi          show output in gibibytes
     --tebi          show output in tebibytes
     --pebi          show output in pebibytes
 -h, --human         show human-readable output
     --si            use powers of 1000 not 1024
 -l, --lohi          show detailed low and high memory statistics
 -t, --total         show total for RAM + swap
 -s N, --seconds N   repeat printing every N seconds
 -c N, --count N     repeat printing N times, then exit
 -w, --wide          wide output

     --help     display this help and exit
 -V, --version  output version information and exit

For more details see free(1).
 

 free 명령어에 대해 알아보았습니다.


문의사항은 댓글을 달아 주시면 성심껏 답변 드리겠습니다.

감사합니다.

댓글 없음:

댓글 쓰기

내 리눅스 서버, 대체 뭐가 문제야?

내 리눅스 서버, 대체 뭐가 문제야? 안녕하세요. 오늘은 리눅스 서버가 버벅거릴 때, 원인을 파악하는 방법에 대해 알아보려고 해요. 서버의 성능 저하 원인을 찾는 것은 시스템 관리에서 매우 중요한 부분이에요. CPU, 메모리 사용량부터 수상한 프로...

가장 많이 본 글