Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like to know if there is a tool that would enable you to watch how the program output changes live. Something like tail -f but instead of monitoring the file changes, it would repeatedly call some executable and display it live.

For example, if the tool is caled foobar and I would call foobar 'ps -Al', it would behave kind of like top - displaying the output in real time.

share|improve this question

1 Answer 1

up vote 10 down vote accepted

Try watch. From the manpage:

Name

watch - execute a program periodically, showing output fullscreen

Synopsis

watch [-dhvt] [-n <seconds>] [--differences[=cumulative]] [--help] [--interval=<seconds>] [--no-title] [--version] <command>

Description

watch runs command repeatedly, displaying its output (the first screenfull). This allows you to watch the program output change over time. By default, the program is run every 2 seconds; use -n or --interval to specify a different interval.

The -d or --differences flag will highlight the differences between successive updates. The --cumulative option makes highlighting "sticky", presenting a running display of all positions that have ever changed. [...]

watch will run until interrupted.

Note that "realtime" would have to be approximated by "once a second" (for example) here...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.