All I want to see is the % after I issue df / every 30s but on the same line just after the previous number.
So the final output would be 86% 86% 86% 87% 87% ......
Could it be one line code? Or multiple line 'program'?
All I want to see is the % after I issue df / every 30s but on the same line just after the previous number.
So the final output would be 86% 86% 86% 87% 87% ......
Could it be one line code? Or multiple line 'program'?
I'd prefer
watch -n 30 df
watch - execute a program periodically, showing output fullscreen
while printf '%s ' "$(df -P / | awk 'NR==2 { print $(NF-1) }')"; do
sleep 30
done
echo
you can use watch:
watch -n 30 -t df /
But that overwrites the existing output
Crude, but works:
while true; do printf "%s " $(df / | awk '/root/ {print $5}'); sleep 30; doneFor bash:
i=1
outputs_per_line=10
frequency=30
while true; do
echo -n "$(df / | awk 'NR==2 {print $5}') "
if [ $((i%outputs_per_line)) -eq 0 ]; then
echo
fi
((i++))
sleep "$frequency"
done
The line break after $outputs_per_line numbers shall prevent a console line break within the output.