Watch (Unix)

Watch (Unix)

In Unix, watch runs the specified command repeatedly and displays the output on stdout so you can watch it change over time. By default, the command is run every 2 seconds, although this is adjustable with the -n "secs" argument. Since the command is passed to sh -c, you may need to encase it in quotes for it to run correctly.

Syntax

watch ["options"] "command" ["command options"]

Example

watch "ps aux | grep php"This will generate a list of processes every 2 seconds, filter for all lines that contain the word "php", and display the results on the screen. The output might look something like this:

Every 2s: ps aux | grep php Tue Jan 30 14:56:33 2007 reconst 30028 0.0 0.0 7044 2596 ? S Jan23 0:00 vim -r core/html_api.php cinonet 28009 0.0 0.2 20708 11064 ? SN Jan25 0:30 php5.cgi donoiz 23810 0.0 0.2 22740 10996 ? SN Jan27 0:30 php.cgi 43/pdf

The watch command is useful for viewing changes over time, like repeatedly running the ls -l command to watch a file's size change, or running ps as in the above example to monitor certain processes continuously.

Arguments

* -d – Highlights differences between iterations
* -h – Displays a help message, then exits
* -n "secs" – Specifies the interval between executions of the command in seconds
* -t – Tells watch not to display the header
* -v – Prints version information, then exits

See also

List of Unix commands

External links

*


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • watch — watch  unix утилита, запускает и следит за программой через фиксированные интервалы времени. Если интервал не задан с помощью опции n, то команда будет запускаться каждые 2 секунды. Завершить программу можно с помощью нажатия соответствующих …   Википедия

  • Watch — unix утилита, запускает и следит за программой через фиксированные интервалы времени. Если интервал не задан с помощью опции n , то команда будет запускаться каждые 2 секунды. Завершить программу можно с помощью нажатия соответствующих клавиш… …   Википедия

  • Watch (disambiguation) — A watch is a timepiece or clock that displays the time.Watch may also refer to: * Watch system, a period of work duty * Tropical cyclone warnings and watches, alerts issued to coastal areas threatened by severe storms * Watch (Unix), a Unix… …   Wikipedia

  • Microsoft Windows Services for UNIX — (SFU) is a software package produced by Microsoft which provides a Unix subsystem and other parts of a full Unix environment on Windows NT and its successors. The subsystem included is called Interix. Like the Microsoft POSIX subsystem in Windows …   Wikipedia

  • Windows Services for UNIX — Microsoft Windows Services for UNIX (SFU) ist ein Software Paket von Microsoft, welches ein Unix Subsystem und andere Komponenten einer Unix Umgebung nach POSIX Standard auf Windows NT (oder neuer) zur Verfügung stellt. Dieses Subsystem wird als… …   Deutsch Wikipedia

  • Windows Services for UNIX — (SFU) or Subsystem for UNIX based Applications (SUA) is a software package produced by Microsoft which provides a Unix subsystem and other parts of a full Unix environment on Windows NT and some of its immediate successor operating systems. It… …   Wikipedia

  • Microsoft Windows Services for UNIX — (SFU) ist ein Software Paket von Microsoft, welches ein Unix Subsystem und andere Komponenten einer Unix Umgebung nach POSIX Standard auf Windows NT (oder neuer) zur Verfügung stellt. Dieses Subsystem wird als Interix bezeichnet.… …   Deutsch Wikipedia

  • dd (Unix) — dd ist ein Unix Befehl, der zum Kopieren und Beschneiden von Datenströmen dient. Inhaltsverzeichnis 1 Hintergrund 2 Geschichte 3 Benutzung 3.1 Operanden …   Deutsch Wikipedia

  • Tail (Unix) — tail est une commande UNIX qui permet d afficher les dernières lignes de texte d un fichier ou de l entrée standard. Syntaxe La syntaxe est la suivante : tail [options] <fichier> Par défaut, tail affiche les 10 dernières lignes de son… …   Wikipédia en Français

  • Bind (Unix) — bind Тип Unix утилиты ОС Unix, GNU/Linux Лицензия GNU GPL v2+ bind утилита командной строки Unix подобной операционной системы для назначения макросов …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”