Finding High mount point greater than threshold in single command

You can use below command to find a mount point whose usage is greater than threshold value

Example below we have 1st filed as mount point name, & 4th field is used percent,

df -k
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 131072 6624 95% 6871 75% /
/dev/hd2 2195456 135588 94% 47519 58% /usr
/dev/hd9var 196608 11772 95% 5181 60% /var

To get only the mount points usage greater than 75, use below command, you might need to replace &4 as per the column number in your server’s df -k output, In our case as from above we are having it in 4th column hence $4

df -k | cut -d'%' -f1 | awk '{ print $1 " " $4 }' | awk '{ if ($2>75) print $1 " " $2; }'

 

0 comments