Linux下free命令显示内存的讲解


# 查看当前机器cpu物理个数:

cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
# 查看cpu中的core的个数(即核数);
cat /proc/cpuinfo | grep "cpu cores" | uniq
# 查看逻辑cpu个数:
cat /proc/cpuinfo | grep "processor" | wc -l
# 内存查看详解
free -m
total      used      free    shared    buffers    cached
Mem:          993        258        734          0        122        44
-/+ buffers/cache:        91        901
Swap:        1023          0      1023
total:内存总数
used:已经使用的内存数
free:空闲的内存数
shared:共享内存大小,主要用于进程间通信
buffers:主要用于块设备数据缓冲
cached:主要用于文件内容缓冲
- buffers/cached = used(第一行)- buffers - cached程序当前"真实使用"的"物理内存"的大小。
+ buffers/cached = buffers + cached实际缓存大小
实际剩余内存=free+buffers+cached

相关内容