查看内存
[root@localhost ~]# free -h
total used free shared buff/cache available
Mem: 3.7G 1.6G 1.0G 12M 1.0G 1.7G
Swap: 2.0G 0B 2.0G
- -h:这个选项意味着 "human-readable"(人类可读的)。它将输出格式化为更易于阅读的方式,例如使用 MB、GB 而不是以字节为单位。
- 还可以用其他参数,-g 以GB单位显示 -m以MB单位显示
解释
- total:显示总内存(Mem)或交换空间(Swap)的大小。
- used:显示已使用的内存或交换空间量。
- free:显示未被使用的内存或交换空间量。
- shared:显示多个进程共享的内存总量。
- buff/cache:显示被用作缓冲和缓存的内存量。
- available:显示可用于新进程的内存估计量,不会引起交换。这是因为一部分 buff/cache 内存实际上是可回收的。
命令使用帮助手册
[root@localhost ~]# 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
--peta show output in petabytes
-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).