返回
创建于
状态公开
free -m 命令的人类可读格式
free -m 命令虽然以 MB 为单位显示内存信息,但还有更人性化的显示方式:
使用 -h 参数(推荐)
1free -h这是最推荐的人类可读格式,会自动选择合适的单位:
- 自动单位转换:根据数值大小自动显示为 B、KB、MB、GB 等
- 易于理解:大数值用 GB,小数值用 MB
- 简洁明了:避免了大串数字
其他有用的选项组合
1# 人类可读 + 每秒更新
2free -h -s 1
3
4# 人类可读 + 显示总计
5free -h -t
6
7# 人类可读 + 宽格式显示
8free -h -w对比效果
使用 free -m:
1total used free shared buff/cache available
2Mem: 7823 2156 3542 256 2124 5123使用 free -h:
1total used free shared buff/cache available
2Mem: 7.6G 2.1G 3.5G 256M 2.1G 5.0G常用参数说明
-h, --human:以人类可读格式显示(KB, MB, GB)-s, --seconds:持续显示,指定更新间隔-t, --total:显示总计行-w, --wide:宽格式输出,分别显示 buffers 和 cache
建议使用 free -h 替代 free -m,获得最佳的可读性体验。