using watch run 2 commands

I have to do watch two commands in the same terminal windows. I mean something like

watch du -h filename.txt && df -h

But its showing only one output.

So what I am thinking is may be its not possible to use watch to run multiple commands on the same window.

If there is any way , Please let me know.

Thank you.


You can quote the commands:

watch "du -h filename.txt && df -h"

And they'll be executed together.


If you want to make sure both commands execute, one of the ways is to separate them with ; instead of &&.

watch 'du -h filename.txt; df -h'

&& allows the execution of second command (second operand, to the right of &&) only if the first command executed successfully (exit status 0). If this is intended behaviour, go with &&.


For completeness sake...

 watch 'du -h filename.txt || true && df -h'

The '|| true' part causes the first command to evaluate as true even if it fails for some reason. This will allow the next command after the && to execute no matter the output of first. This is most likely unnecessary for the scenario, just showing it to be possible.