[Ilugc] watch a process every few seconds

  • From: knura9@xxxxxxxxx (Arun Khan)
  • Date: Fri, 30 Nov 2012 22:14:01 +0530

On Fri, Nov 30, 2012 at 8:02 PM, Girish Venkatachalam
<girishvenkatachalam at gmail.com> wrote:

On Fri, Nov 30, 2012 at 5:21 PM, Guruprasad <lgp171188 at gmail.com> wrote:

On Fri, Nov 30, 2012 at 4:35 PM, Girish Venkatachalam
<girishvenkatachalam at gmail.com> wrote:
You have watch command.

$ watch ls -ltr

or you can get a clock with watch.

Just think...

Doesn't this list the contents of a directory ordered by modified time
in reverse order? But the subject says "watch a process every few
seconds".


Please read my mail carefully. Again. Ask your friends.


I concur with Guruprasad.

man watch, in Debian Wheezy, gives the following:

watch - execute a program periodically, showing output fullscreen

*periodically* is the key word above.

While your *subject line* seems to suggest that  "the" process is
running continuously and one can watch it's std out/err periodically
for instance what  top does in default mode.

In the example that you have cited, ls -ltr runs once, it's std out
displayed and that PID is gone.   The next time watch executes ls -lt
is a *new* process i.e. new PID.

-- Arun Khan

Other related posts: