Site icon New Generation Enterprise Linux

Master `watch`: Real-time Command Output Made Easy

Quick Tip

Master `watch`: Real-time Command Output Made Easy

Challenge: You need to monitor the output of a command that changes frequently, like disk usage, network traffic, or the contents of a log file, without repeatedly typing the command yourself.

The Solution: Use the `watch` command to periodically execute a command and display its output in full-screen, updating at a specified interval.

watch -n 5 'df -h /'

Why it works: The `watch` command runs the specified command (`df -h /` in this case) every `n` seconds (5 seconds here) and updates the terminal display with the latest output, making real-time monitoring effortless.

Pro-Tip: Use `watch -d` to highlight the differences between updates, making it easier to spot changes.

Linux Tips & Tricks | © ngelinux.com | 6/1/2026

0 0 votes
Article Rating
Exit mobile version