Chapter 11. Watch That File

You know what they say, a watched pot never boils. That’s why it makes good sense to use this little tool to watch it for you. Waiting for mail? Want to see if a job has completed? Watch can help.

Watch allows you to see a real-time display of the latest output—the first screenful of output—from a command. So instead of you having to retype the command 50 times while you wait for whatever to occur, you tell watch to do it for you. By default, watch reissues your command every 2 seconds.

The basic format for the watch command is:

linux~>watch process-name

Once started, watch keeps running until it is stopped.

Note

You don’t want to use watch with programs that keep running. If you do, you’ll be sorry. Here’s why.

For example, ...

Get CLI for Noobies: A Primer on the Linux Command Line now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.