Sometimes you need to see updates to something in the terminal but the program that you’re running isn’t telling you what’s going on. One example of this is dd which unhelpfully shows you nothing until it has finished executing.
If, for example, I were running the dd command as follows:
dd if=/dev/diskx of=~/Desktop/output.iso
and I wanted to see how far the copy had prgressed, I could use a bash infinite loop with the ls command to constantly check the file size of the output file. If I knew the size of the input file then I’d be golden. Something like this would do the trick:
while : ; do ls -l ~/Desktop/output.iso ; sleep 1 ; clear ; done
This would give me a continually updating filesize of the output file. Once that file size stops increasing I’d just hit
CTRL+C to break out of the loop.