watch multiple Linux commands

Occasionally I’ll have the need to watch screen output of multiple commands on the Linux CLI. Supremely easy but I don’t do it often enough to remember that I need to wrap the sequence in single (‘) or double (“) quotes. Correct formatting is below:

Single quotes are required when some part of your command string has double quotes already:

watch 'cat /var/log/some*.log | grep "regex[1-9]"'

Double quotes are fine when your command string doesn’t have existing double quotes:

watch "command1 && command2"


watch "command1 ; command2"

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.