{"id":168,"date":"2026-04-19T10:27:03","date_gmt":"2026-04-19T09:27:03","guid":{"rendered":"https:\/\/vpp.dk\/?linux_trick=run-a-command-every-n-seconds"},"modified":"2026-04-19T10:27:03","modified_gmt":"2026-04-19T09:27:03","slug":"run-a-command-every-n-seconds","status":"publish","type":"linux_trick","link":"https:\/\/vpp.dk\/?linux_trick=run-a-command-every-n-seconds","title":{"rendered":"Run a command every N seconds"},"content":{"rendered":"<p>The watch command re-runs a command at a set interval and displays the output \u2014 great for monitoring.<\/p>\n","protected":false},"template":"","meta":{"_trick_code":"# Refresh every 2 seconds (default):\nwatch df -h\n\n# Every 0.5 seconds, highlight differences:\nwatch -n 0.5 -d 'free -m'","_trick_uploader":"crontab_fan"},"trick_category":[18,20],"class_list":["post-168","linux_trick","type-linux_trick","status-publish","hentry","trick_category-process-management","trick_category-system-info"],"_links":{"self":[{"href":"https:\/\/vpp.dk\/index.php?rest_route=\/wp\/v2\/linux_trick\/168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpp.dk\/index.php?rest_route=\/wp\/v2\/linux_trick"}],"about":[{"href":"https:\/\/vpp.dk\/index.php?rest_route=\/wp\/v2\/types\/linux_trick"}],"wp:attachment":[{"href":"https:\/\/vpp.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168"}],"wp:term":[{"taxonomy":"trick_category","embeddable":true,"href":"https:\/\/vpp.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftrick_category&post=168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}