home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 51.6 Cleaning script Files Chapter 51
Miscellaneous Useful Programs and Curiosities
Next: 51.8 Type Bang Splat.  Don't Forget the Rabbit Ears
 

51.7 When You Get Impatient

vis
Sometimes you find yourself repeating the same command over and over again - for example, ps ( 38.5 ) to monitor the progress of your background processes, or lpq ( 43.2 ) to know when your printout is finished. Instead of typing the same command repeatedly, or even using C shell history ( 11.1 ) to repeat it, use the vis command. For example:

% 

vis ps

The vis command takes over your screen and shows the output of the initial ps command. Every 15 seconds, the command is executed again and your screen is updated with the new information. If this delay is too long for you, you can get vis to use a shorter delay using the -d option:

% 

vis -d 2 ps

The information will now be updated every 2 seconds. Your screen is cleared and you are shown the output of ps . On the top line, vis tells you the command being run, how long your delay is (if not the default), and how many times it has been executed. The Exec: line is incremented every time the command is repeated.

Command:  ps                      Delay:  2            Exec:  1

  PID TT STAT  TIME COMMAND
 2971 p1 S     0:06 -sh (csh)
 6139 p1 S     0:00 vis -d 2 ps
 6145 p1 R     0:00 ps
 3401 q0 IW    0:13 -sh (csh)
 5954 q0 S     0:01 vi ch01
14019 q5 IW    0:02 -sh (csh)
29380 r7 IW    0:00 -bin/csh (csh)
29401 rd IW    0:00 -bin/csh (csh)

vis provides a few other command-line options. The -s option is particularly neat - using -s , any lines that have changed since the last iteration are printed in standout mode.

Note that variations of this command have floated around in the public domain under several different names, such as display , rep , and watch . We found vis to be the most useful.

- LM


Previous: 51.6 Cleaning script Files UNIX Power Tools Next: 51.8 Type Bang Splat.  Don't Forget the Rabbit Ears
51.6 Cleaning script Files Book Index 51.8 Type Bang Splat. Don't Forget the Rabbit Ears

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System