打印本机的交换分区大小
答案:
free -m | sed -n '/Swap/p' | awk '{print $2}'
解析:
free -m
查看系统内存使用情况
sed -n ‘/Swap/p’
打印匹配Swap的行
awk '{print $2}'
awk缺省的行分隔符是换行,缺省的列分隔符是连续的空格和Tab.
打印第二列