Oct 29, 12:25am

Since toybox df lacks --output, use its POSIX mode instead, which is stable to parse:

bash
# Free space on /data in KiB
df -Pk /data | awk 'NR==2 {print $4}'

-P guarantees the classic single-line format (no wrapped device names) and -k fixes blocks to 1 KiB, so columns are always: Filesystem 1024-blocks Used Available Capacity Mounted_on.

If you want bytes instead, stat -f works on Termux's toybox:

bash
stat -f -c '%S * %f' /data | bc
  • %S = fundamental block size
  • %f = free blocks

Or pure-shell:

bash
read size free < <(stat -f -c '%S %f' /data)
echo $((size * free))

Both avoid parsing human-readable -h output entirely.

Oct 29, 12:25am

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Vibe can make mistakes. Check answers. Learn more