关键命令:
df | sed -rn '/^\/dev\/sd/s#.* ([0-9]+)%.*#\1#p'|sort -nr|head -n1
df |tail -n +2 |tr -s ' ' % |cut -d% -f5 |sort -nr |head -n1
df |grep '^/dev/sd' |grep -oE '\<[0-9]{,3}%'|grep -Eo '[0-9]+'|sort -nr|head -n1
df | grep '^/dev/sd' |tr -s ' ' %|cut -d% -f5|sort -n|tail -1
df |grep '^/dev/sd' |grep -oE '\<[0-9]{,3}%'|tr -d '%'|sort -nr|head -n1
[root@centos7 ~]#df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 1002956 0 1002956 0% /dev
tmpfs 1013948 0 1013948 0% /dev/shm
tmpfs 1013948 9792 1004156 1% /run
tmpfs 1013948 0 1013948 0% /sys/fs/cgroup
/dev/sda2 104806400 2588684 102217716 3% /
/dev/sda3 52403200 32992 52370208 1% /data
/dev/sda1 999320 104520 825988 12% /boot
tmpfs 202792 0 202792 0% /run/user/0
[root@centos7 ~]#df | sed -rn '/^\/dev\/sd/s#.* ([0-9]+)%.*#\1#p'|sort -nr|head -n1
12
[root@centos7 ~]#df |tail -n +2 |tr -s ' ' % |cut -d% -f5 |sort -nr |head -n1
12
[root@centos7 ~]#df |grep '^/dev/sd' |grep -oE '\<[0-9]{,3}%'|grep -Eo '[0-9]+'|sort -nr|head -n1
12
[root@centos7 ~]#df | grep '^/dev/sd' |tr -s ' ' %|cut -d% -f5|sort -n|tail -1
12
[root@centos7 ~]#df |grep '^/dev/sd' |grep -oE '\<[0-9]{,3}%'|tr -d '%'|sort -nr|head -n1
12