System and processes

The watch command

Repeats a command every few seconds to watch for a change: memory, space, connections...

Syntax

watch [-n SEGUNDOS] COMANDO

Most useful options

-n SEGUNDOSHow often it repeats (2 by default)
Ctrl+CQuits watch

Copy-ready examples

$ watch -n 1 dateThe time updating
$ watch -n 2 'df -h'Watch the free space

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • Here a single simulated pass is shown; on real Linux it refreshes until Ctrl+C.
  • If the command has pipes or quotes, wrap it in quotes.

Related commands

FAQ

Can I highlight what changes?

Yes, with watch -d on a real Linux.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course