df /path/to/dir | sed -ne 2p | awk '{print $4}'
sed -ne 2p
prints the 2nd lineawk '{print $4}'
prints the 4th columnThe output of the df command might be different depending on the system, and the available space might not be the 4th column. Make the necessary adjustments depending on your system.