You are not logged in.

#1 2014-10-18 12:15:09

bzpnbx
Member
Registered: 2014-10-05
Posts: 35

Program similar to 'watch' available in repositories?

On other linux distros, a program I often use to monitor lsof in "real time" is 'watch'. Sadly, it appears that this app is not available in the Arch repos. Does anyone know of a similar app that performs the same function?

Here's the man page from 'watch' from an ubuntu box:

WATCH(1)                                                        User Commands                                                        WATCH(1)



NAME
       watch - execute a program periodically, showing output fullscreen

SYNOPSIS
       watch [options] command

DESCRIPTION
       watch  runs  command repeatedly, displaying its output and errors (the first screenfull).  This allows you to watch the program output
       change over time.  By default, the program is run every 2 seconds.  By default, watch will run until interrupted.

OPTIONS
       -d, --differences [permanent]
              Highlight the differences between successive updates.  Option will read optional argument that changes highlight to  be  perma‐
              nent, allowing to see what has changed at least once since first iteration.

       -n, --interval seconds
              Specify  update  interval.   The  command will not allow quicker than 0.1 second interval, in which the smaller values are con‐
              verted.

       -p, --precise
              Make watch attempt to run command every interval seconds. Try it with ntptime and  notice  how  the  fractional  seconds  stays
              (nearly) the same, as opposed to normal mode where they continuously increase.

       -t, --no-title
              Turn  off  the header showing the interval, command, and current time at the top of the display, as well as the following blank
              line.

       -b, --beep
              Beep if command has a non-zero exit.

       -e, --errexit
              Freeze updates on command error, and exit after a key press.

       -g, --chgexit
              Exit when the output of command changes.

       -c, --color
              Interpret ANSI color sequences.

       -x, --exec
              command is given to sh -c which means that you may need to use extra quoting to get the desired effect.  This with  the  --exec
              option, which passes the command to exec(2) instead.

       -h, --help
              Display help text and exit.

       -v, --version
              Display version information and exit.

NOTE
       Note  that  POSIX  option  processing is used (i.e., option processing stops at the first non-option argument).  This means that flags
       after command don't get interpreted by watch itself.

EXAMPLES
       To watch for mail, you might do

              watch -n 60 from

       To watch the contents of a directory change, you could use

              watch -d ls -l

       If you're only interested in files owned by user joe, you might use

              watch -d 'ls -l | fgrep joe'

       To see the effects of quoting, try these out

              watch echo $$
              watch echo '$$'
              watch echo "'"'$$'"'"

       To see the effect of precision time keeping, try adding -p to

              watch -n 10 sleep 1

       You can watch for your administrator to install the latest kernel with

              watch uname -r

       (Note that -p isn't guaranteed to work across reboots, especially in the face of ntpdate or other bootup time-changing mechanisms)

BUGS
       Upon terminal resize, the screen will not be correctly repainted until the next scheduled update.  All --differences  highlighting  is
       lost on that update as well.

       Non-printing characters are stripped from program output.  Use "cat -v" as part of the command pipeline if you want to see them.

       Combining  Characters  that are supposed to display on the character at the last column on the screen may display one column early, or
       they may not display at all.

       Combining Characters never count as different in --differences mode.  Only the base character counts.

       Blank lines directly after a line which ends in the last column do not display.

       --precise mode doesn't yet have advanced temporal distortion technology to compensate for a command that takes more than interval sec‐
       onds to execute.  watch also can get into a state where it rapid-fires as many executions of command as it can to catch up from a pre‐
       vious executions running longer than interval (for example, netstat taking ages on a DNS lookup).

EXIT STATUS
              0      Success.
              1      Various failures.
              2      Forking the process to watch failed.
              3      Replacing child process stdout with write side pipe failed.
              4      Command execution failed.
              5      Closign child process write pipe failed.
              7      IPC pipe creation failed.
              8      Getting child process return value with waitpid(2) failed, or command exited up on error.
              other  The watch will propagate command exit status as child exit status.
AUTHORS
       The original watch was written by Tony Rems ⟨rembo@unisoft.com⟩ in 1991, with  mods  and  corrections  by  Francois  Pinard.   It  was
       reworked and new features added by Mike Coleman ⟨mkc@acm.org⟩ in 1999. The beep, exec, and error handling features were added by Morty
       Abzug ⟨morty@frakir.org⟩ in 2008.  On a not so dark and stormy morning in March of 2003, Anthony DeRobertis ⟨asd@suespammers.org⟩  got
       sick  of  his watches that should update every minute eventually updating many seconds after the minute started, and added microsecond
       precision.  Unicode support was added in 2009 by Jarrod Lowe ⟨procps@rrod.net⟩



procps-ng                                                         June 2011                                                          WATCH(1)

Offline

#2 2014-10-18 12:23:48

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: Program similar to 'watch' available in repositories?

Seems you are mistaken. It is installed on my system and according to a quick inspection, it is part of the procps-ng package.

Offline

#3 2014-10-18 12:37:01

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: Program similar to 'watch' available in repositories?

For future reference, you can use pkgfile to search for files and determine the packages that contain them, e.g.

$ pkgfile watch
core/procps-ng
extra/adwaita-icon-theme
extra/bash-completion
extra/kdebase-workspace
extra/oxygen
extra/xcursor-themes
community/mate-themes
community/xcursor-bluecurve
community/xcursor-flatbed
community/xcursor-neutral
community/xcursor-pinux
community/xcursor-premium
community/xcursor-simpleandsoft
community/xcursor-vanilla-dmz
community/xcursor-vanilla-dmz-aa
$ pkgfile /usr/bin/watch
core/procps-ng

My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone

Offline

#4 2014-10-18 13:06:54

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Program similar to 'watch' available in repositories?

There's also the -b flag, which filters down to PATH-ish directories.

$ pkgfile -b watch
core/procps-ng

Offline

#5 2014-10-18 13:27:33

bzpnbx
Member
Registered: 2014-10-05
Posts: 35

Re: Program similar to 'watch' available in repositories?

runical wrote:

Seems you are mistaken. It is installed on my system and according to a quick inspection, it is part of the procps-ng package.

How did it get installed on your system? When you installed 'procps-ng'? How on earth would I know to install that to get watch?

On other distros, watch is its own app that you can install explicitly.

'pkgfile' is its own app that I have to install to find the package that will install 'procps-ng' which will allow me to get 'watch'?

Here's what I get:

$ pkgfile watch
bash:  pkgfile:  command not found

falconidy, thanks for pointing out the -b flag. I had no idea how Xyne pulled procps-ng as the relevant package from that list.

Last edited by bzpnbx (2014-10-18 13:29:23)

Offline

#6 2014-10-18 13:32:05

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: Program similar to 'watch' available in repositories?

bzpnbx, please read the responses more carefully - all your follow up questions have been answered.

1) How would you know that watch is part of procps-ng?  Use pkgfile

2) Do you need pkgfile in order to get watch?  No, not now, just install procps-ng.  But pkgfile will allow you to answer this type of question for yourself in the future.

3) While falconindy's suggestion is handy, Xyne's post already identified how to narrow down which was the relevant package.  Apparently many packages include a file called 'watch', but when Xyne checked for a package owning a file called "/usr/bin/watch" there was only one: procps-ng.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2014-10-18 13:36:15

bzpnbx
Member
Registered: 2014-10-05
Posts: 35

Re: Program similar to 'watch' available in repositories?

Trilby wrote:

bzpnbx, please read the responses more carefully - all your follow up questions have been answered.

1) How would you know that watch is part of procps-ng?  Use pkgfile

2) Do you need pkgfile in order to get watch?  No, not now, just install procps-ng.  But pkgfile will allow you to answer this type of question for yourself in the future.

3) While falconindy's suggestion is handy, Xyne's post already identified how to narrow down which was the relevant package.  Apparently many packages include a file called 'watch', but when Xyne checked for a package owning a file called "/usr/bin/watch" there was only one: procps-ng.

Was /usr/bin/watch an educated guess by Xyne? Nothing in the pkgfile output indicated that directory path, right? Just expeirence on Xyne's part to know to check that path?

Offline

#8 2014-10-18 13:37:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: Program similar to 'watch' available in repositories?

I suppose you might say that.  However, while Xyne is quite educated, I don't know how much was needed for that guess.  You are looking for a binary named 'watch'.  Where else in the directory structure would it live?  Binary programs are kept in /usr/bin/


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2014-10-18 13:41:52

bzpnbx
Member
Registered: 2014-10-05
Posts: 35

Re: Program similar to 'watch' available in repositories?

Trilby wrote:

I suppose you might say that.  However, while Xyne is quite educated, I don't know how much was needed for that guess.  You are looking for a binary named 'watch'.  Where else in the directory structure would it live?  Binary programs are kept in /usr/bin/

Yes. But I was interested to know if it was just from know-how or some info was presented from that output that also indicated that. I just wanted to make sure that that's how he knew to check /usr/bin and not that I just assume that. I've been assuming quite a lot that has been flat wrong (since moving to Arch).

Offline

#10 2014-10-18 14:35:50

parchd
Member
Registered: 2014-03-08
Posts: 421

Re: Program similar to 'watch' available in repositories?

Isn't procps-ng in base anyway, and therefore almost certainly installed already? watch has always been such a core part of the way I work that I would never even think of having to install it explicitly.

Offline

#11 2014-10-18 15:58:51

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Program similar to 'watch' available in repositories?

bzpnbx wrote:

I was interested to know if it was just from know-how or some info was presented from that output that also indicated that. I just wanted to make sure that that's how he knew to check /usr/bin and not that I just assume that.

All user-installed binaries on GNU/Linux systems are placed in the /usr/bin directory. Yes, this is common knowledge, hence Trilby basically asking "Where else would they be?"

parchd wrote:

Isn't procps-ng in base anyway, and therefore almost certainly installed already?

It is in the base group, but it doesn't appear to be a dependency of any other base package. So if you installed your system using 'pacstrap -i' to manually select base packages and didn't explicitly select procps-ng, it wouldn't have been installed.

Offline

#12 2014-10-18 16:56:12

parchd
Member
Registered: 2014-03-08
Posts: 421

Re: Program similar to 'watch' available in repositories?

Ah, I see. Thanks ANOKNUSA

Offline

Board footer

Powered by FluxBB