watch file size on linux
watch -n 5 "du -h club_prod.sql"
You're piping the output of watch
into awk
. If you simplify your command line, what you have is:
watch <some arguments> | awk '{print $5}'
That's not what you want. Try:
watch -n 5 "ls -lh club_prod.sql | awk '{print \$5}'"
Not exactly related, but if you want to monitor growth rate of some file, you could use following command:
tail -f yourfile.txt | pv > /dev/null
tail -f
- outputs data appended to filepv
- measures data flow through pipe> /dev/null
- standard output gets discarded
Note: sometimes pv
may be not preinstalled
I hope this will help somebody :)