I want to watch the growing size of a single file, so i use this command:
texai@maelstrom ~$ ls -lh club_prod.sql | awk '{print $5}'
116M
Now I want to watch that result each 5 seconds so:
texai@maelstrom ~$ watch -n 5 ls -lh club_prod.sql | awk '{print $5}'
but this command doesn't return any result
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}'"