Sponsored Content
Operating Systems HP-UX looking for a unix command for hpux - watch Post 302392274 by mr_manny on Wednesday 3rd of February 2010 11:06:14 PM
Old 02-04-2010
users continue to be pleased w/script Smilie

TonyFullerMalv,
thanks for the links, Rosetta is a new one for me...

DukeNuke2,
sorry for the code tags....or lack of.
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Linux watch command on AIX?

On Linux I could use the `watch` command to loop a command X times. Is there a similar command on AIX? If not, is there a way to write a loop on the command line to do this? Linux: watch -d -n 60 'db2 list applications show detail | grep Connect | wc -l' AIX: ??? (2 Replies)
Discussion started by: djschmitt
2 Replies

2. Solaris

Any command to watch output repeatedly??

Hi Experts,, Can you tell me "Is there any command in solaris that gives the output repeatedly for every x seconds" when used with other commands like ls,du,df,etc..Like prstat updates its output for every 5 seconds.. If i want to view how much of disk usage is going on a filesystem for every... (2 Replies)
Discussion started by: sdspawankumar
2 Replies

3. Shell Programming and Scripting

Command similar to watch

Hi all, I am trying to create a file that shows the CPU usage, constantly updating (similar to TOP). So far i have a file (called test) containing: echo "The current CPU usage is:" `ps -e -o pcpu|awk 'NR > 0 { s +=$1 }; END {print s"%"}'` and then I ran the command: watch -d 0.5 -t... (3 Replies)
Discussion started by: mikejreading
3 Replies

4. UNIX for Dummies Questions & Answers

watch command

Hi, Please help me out! In the man pages they dont talk about any options that can be used to terminate a running 'watch' command. Do you know a way of terminating the command using an option? Thanks (1 Reply)
Discussion started by: foxtron
1 Replies

5. Shell Programming and Scripting

Use script to monitor command output question? (like Linux watch)

Hi I want to write a script, help me to monitor command output. This script like Linux "watch" command. Below is my script: # cat watch.sh #!/bin/bash while true do clear echo "command: $*" ( $* ) sleep 2 done Then I run this script below (2 Replies)
Discussion started by: nnnnnnine
2 Replies

6. Shell Programming and Scripting

Using the watch command

so i have a very long script which i have to run. when i run this script, i want to monitor the the openssl commands it runs. the way ive attempted to do this is: watch -t -n 1 "(date '+TIME:%H:%M:%S' ; ps aux | egrep openssl | egrep -v grep)" 2>&1 | tee -a logfile the above command is... (2 Replies)
Discussion started by: SkySmart
2 Replies
WATCH(1)							Linux User's Manual							  WATCH(1)

NAME
watch - execute a program periodically, showing output fullscreen SYNOPSIS
watch [-bdehpvtx] [-n seconds] [--beep] [--color] [--differences[=cumulative]] [--errexit] [--exec] [--help] [--interval=seconds] [--no-title] [--precise] [--version] 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; use -n or --interval to specify a different interval. Normally, this interval is interpreted as the amout of time between the completion of one run of command and the beginning of the next run. However, with the -p or --precise option, you can make watch attempt to run command every interval seconds. Try it with ntptime and notice how the fractional sec- onds stays (nearly) the same, as opposed to normal mode where they continuously increase. The -d or --differences flag will highlight the differences between successive updates. Using --differences=cumulative makes highlighting "sticky", presenting a running display of all positions that have ever changed. The -t or --no-title option turns off the header showing the interval, command, and current time at the top of the display, as well as the following blank line. The -b or --beep option causes the command to beep if it has a non-zero exit. watch will normally run until interrupted. If you want watch to exit on an error from the program running use the -e or --errexit options, which will cause watch to exit if the return value from the program is non-zero. By default watch will normally not pass escape characters, however if you use the --c or --color option, then watch will interpret ANSI color sequences for the foreground. NOTE
Note that command is given to "sh -c" which means that you may need to use extra quoting to get the desired effect. You can disable this with the -x or --exec option, which passes the command to exec(2) instead. 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 seconds 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 previous exe- cutions running longer than interval (for example, netstat taking ages on a DNS lookup). 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. Uni- code support was added in 2009 by Jarrod Lowe <procps@rrod.net>. 2010 Mar 01 WATCH(1)
All times are GMT -4. The time now is 05:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy