Linux Commands Reference - Complete Linux Command Guide

Comprehensive Linux command reference with 150+ commands. Search, filter by category, and view detailed usage examples.

Share
Back to commands

watch

Execute command periodically, full-screen display

Syntax

watch [OPTION] COMMAND

Common Options

-nSet interval seconds (default 2)
-dHighlight changes
-tNo header
-bBeep on command failure
-eExit on command error
-gExit when output changes
-cInterpret ANSI colors
-xPass command to exec

Common Examples

watch df -h

Refresh disk space every 2s

watch -n 5 free -m

Refresh memory every 5s

watch -d nvidia-smi

Highlight GPU changes

watch "ps aux | grep nginx"

Monitor nginx process

watch -t date

Show time without header

watch -g "ls -l output.txt"

Exit when file changes

watch -n 1 -d "ss -tlnp"

Monitor ports with changes

watch -n 10 "curl -s http://localhost/health"

Periodic health check

Related Commands

Related Tools

More Code & Dev Tools