I am trying to find available disk space through console
I found df -h | awk '$NF == "/" { print $4 }'
to get required output.
[root@tmpe2etstmsdc01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root 542G 22G 492G 5% /
tmpfs 127G 0 127G 0% /dev/shm
Avail
[root@tmpe2etstmsdc01 ~]# df -h | awk '$NF == "/" { print $4 }'
492G
This gives Use%
value when Filesystem
is long
[root@ldrnr-tlsmsdc16 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root
16G 16G 0 100% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
Here, the command gives Use%
instead of Avail
[root@ldrnr-tlsmsdc16 ~]# df -h | awk '$NF == "/" { print $4 }'
100%
How can i get Avail
in this condition?