In my Systems Programming class, there are weekly programming experiments, and I'm having trouble with the current one.
The objective is to write a C program that slowly writes a string of text to a file, metered by usleep()
in a 100 count for loop.
The goal of the experiment is to observe the file size buffer in action via the watch command. However, I can't get it to work using watch -d ./output
What syntax do I need for the watch command to see the changes made to the file size?
You can use
du
to check a file's size (strictly speaking, its disk usage):If you want shorter than one second intervals, you can also execute
du
in an endless loop, sleeping afterwards for, say, 0.1 seconds:Or remove the sleep entirely.
Have a look at
man du
for more options.