Linux free 命令
简介
free命令用于显示内存状态。 free指令会显示内存总大小,内存使用、内存空闲、共享、缓存、可用的情况以及交换分区
语法
free [options]
free 参数
参数说明
-b,–bytes 以Byte为单位显示内存使用情况。
# free -b
total used free shared buff/cache available
Mem: 16639868928 3472809984 3391094784 855474176 9775964160 11558871040
Swap: 0 0 0
-k,kilo 以KB为单位显示内存使用情况。
# free -k
total used free shared buff/cache available
Mem: 16249872 3392492 3310484 835424 9546896 11286852
Swap: 0 0 0
-m,–mega 以MB为单位显示内存使用情况。
# free -m
total used free shared buff/cache available
Mem: 15869 3316 3229 815 9323 11018
Swap: 0 0 0
-g,–giga 以GB为单位显示内存使用情况。
# free -g
total used free shared buff/cache available
Mem: 15 3 3 0 9 10
Swap: 0 0 0
--tera 以TB为单位显示内存使用情况。
# free --tera
total used free shared buff/cache available
Mem: 0 0 0 0 0 0
Swap: 0 0 0
-h,–human 以合适的单位显示内存使用情况 。
# free -h
total used free shared buff/cache available
Mem: 15G 3.2G 3.2G 815M 9.1G 10G
Swap: 0B 0B 0B
--si 使用1000的幂而不是1024
# free --si
total used free shared buff/cache available
Mem: 16249872 3398620 3304248 835424 9547004 11280812
Swap: 0 0 0
-l,–lohi 显示详细的低内存和高内存统计
# free -l
total used free shared buff/cache available
Mem: 16249872 3395368 3307560 835424 9546944 11284172
Low: 16249872 12942312 3307560
High: 0 0 0
Swap: 0 0 0
-t,–total 显示内存总和列。
# free -t
total used free shared buff/cache available
Mem: 16249872 3397084 3305796 835424 9546992 11282456
Swap: 0 0 0
Total: 16249872 3397084 3305796
-s N<间隔秒数>,–seconds N 持续观察内存使用状况。
# free -s 3
total used free shared buff/cache available
Mem: 16249872 3395084 3307728 835424 9547060 11284424
Swap: 0 0 0
total used free shared buff/cache available
Mem: 16249872 3383960 3318848 835424 9547064 11295548
Swap: 0 0 0
total used free shared buff/cache available
Mem: 16249872 3381348 3321452 835424 9547072 11298160
Swap: 0 0 0
-c N<次数>,–count N 打印N次后退出
# free -c 2
total used free shared buff/cache available
Mem: 16249872 3376424 3326360 835424 9547088 11303116
Swap: 0 0 0
total used free shared buff/cache available
Mem: 16249872 3376588 3326196 835424 9547088 11302952
Swap: 0 0 0
-w,wide 宽度输出
# free -w
total used free shared buffers cache available
Mem: 16249872 3381412 3321320 835424 2072 9545068 11298128
Swap: 0 0 0
–help 查看帮助
# free --help
Usage:
free [options]
Options:
-b, --bytes show output in bytes
-k, --kilo show output in kilobytes
-m, --mega show output in megabytes
-g, --giga show output in gigabytes
--tera show output in terabytes
-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).
-V,–version 查看版本
# free -V
free from procps-ng 3.3.10
free命令
# free
total used free shared buff/cache available
Mem: 16249872 3393764 3309348 835424 9546760 11285328 #内存空间
Swap: 0 0 0 #交换空间
#总数 #使用量 #空闲量 #共享区 #缓存区 #可用空间