当前位置:首页 > linux > 正文

linux系统怎么查看内存(linux怎么查看内存使用情况)

  • linux
  • 2024-03-15 19:06:25
  • 613
如何查看 Linux 系统内存
要素 1:使用 free 命令
Bash
free
此命令显示系统内存的总量、已用内存、可用内存和缓冲/高速缓存内存。
total used free shared buff/cache available
Mem: 512M 472M 40M 0M 0M 46M
Swap: 1024M 18M 980M
要素 2:使用 vmstat 命令
Bash
vmstat
此命令每隔 1 秒更新一次,显示内存使用信息以及其他系统统计数据。
procs -----------memory---------- ---swap--- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa st
2 0 0 272048 1040 928 0 0 4 0 0 0 2 1 97 0 0
free: 可用内存
buff/cache: 缓冲和高速缓存内存
要素 3:使用 /proc/meminfo 文件
Bash
cat /proc/meminfo
此文件包含有关系统内存的各种信息,包括:
MemTotal: 512000 kB
MemFree: 40624 kB
MemAvailable: 255352 kB
Buffers: 0 kB
Cached: 0 kB
SwapCached: 236 kB
Active: 392792 kB
Inactive: 108672 kB
Active(anon): 371232 kB
Inactive(anon): 106592 kB
MemTotal: 系统总内存
MemFree: 可用内存
MemAvailable: 用于应用程序的可用内存
Active: 被应用程序主动使用的内存
Inactive: 不再使用的,但尚未释放的内存