Linux tricks, one-liners & shell magic
← Back to all tricks
Run a command every N seconds

The watch command re-runs a command at a set interval and displays the output — great for monitoring.

bash
$ # Refresh every 2 seconds (default): watch df -h # Every 0.5 seconds, highlight differences: watch -n 0.5 -d 'free -m'
crontab_fan2026-04-19
Delete this trick? This cannot be undone.