Knowledge (XXG)

watch (command)

Source 📝

952: 974: 205:
Every 2s: ps -e | 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 ?
1000: 202:
every two seconds, filter for all lines that contain the word "php", and display the results on the screen. The output might look something like this:
340: 161:
so the user can watch it change over time. By default, the command is run every two seconds, although this is adjustable with the
965: 960: 82: 333: 937: 907: 922: 978: 683: 352: 326: 318: 279: 853: 801: 199: 154: 119: 114: 526: 516: 753: 658: 653: 126: 102: 932: 876: 781: 582: 485: 871: 806: 791: 728: 688: 567: 531: 425: 209:
The watch command is useful for viewing changes over time, like repeatedly running the
994: 912: 773: 708: 480: 455: 356: 886: 786: 703: 698: 602: 511: 475: 430: 313: 298:: execute a program periodically, showing output fullscreen –  822: 796: 733: 723: 713: 678: 668: 663: 546: 536: 490: 638: 597: 400: 370: 46: 36: 927: 881: 861: 758: 738: 693: 541: 465: 450: 435: 420: 415: 410: 405: 192: 131: 107: 17: 843: 623: 303: 648: 572: 172:, it may be necessary to encase it in quotes for it to run correctly. 88: 633: 375: 253:– Specifies the interval between executions of the command in seconds 158: 293: 220:
as in the above example to monitor certain processes continuously.
866: 763: 743: 673: 592: 495: 470: 445: 395: 390: 385: 380: 299: 143: 308: 917: 891: 827: 748: 643: 628: 587: 577: 521: 349: 322: 718: 618: 562: 460: 440: 211: 1001:
Linux process- and task-management-related software
900: 852: 836: 815: 772: 611: 555: 504: 363: 125: 113: 101: 81: 63: 45: 35: 216:command to watch a file's size change, or running 334: 8: 30: 234:– Highlights differences between iterations 973: 341: 327: 319: 29: 168:argument. Since the command is passed to 269:– Prints version information, then exits 261:– Tells watch not to display the header 157:repeatedly and displays the results on 242:– Displays a help message, then exits 7: 142:is a command-line tool, part of the 153:packages, that runs the specified 25: 206:SN Jan27 0:30 php.cgi 43/pdf 972: 951: 950: 1: 198:This will generate a list of 69:; 33 years ago 1017: 946: 966:Unix SUS2008 utilities 961:Standard Unix programs 353:command-line interface 280:List of Unix commands 27:GNU command-line tool 854:Software development 32: 37:Original author(s) 988: 987: 137: 136: 16:(Redirected from 1008: 976: 975: 954: 953: 556:User environment 343: 336: 329: 320: 297: 296: 267: 259: 251: 240: 232: 219: 215: 171: 167: 152: 148: 103:Operating system 97: 94: 92: 90: 77: 75: 70: 51:Francois Pinard, 33: 21: 1016: 1015: 1011: 1010: 1009: 1007: 1006: 1005: 991: 990: 989: 984: 942: 896: 848: 832: 811: 768: 612:Text processing 607: 551: 500: 359: 347: 292: 291: 288: 276: 265: 257: 246: 238: 230: 226: 217: 210: 207: 196: 195:-e | grep php" 189: 184: 178: 169: 162: 159:standard output 150: 146: 87: 73: 71: 68: 64:Initial release 58: 56: 55:Albert Cahalan, 54: 52: 28: 23: 22: 15: 12: 11: 5: 1014: 1012: 1004: 1003: 993: 992: 986: 985: 983: 982: 970: 969: 968: 963: 947: 944: 943: 941: 940: 938:true and false 935: 930: 925: 920: 915: 910: 904: 902: 898: 897: 895: 894: 889: 884: 879: 874: 869: 864: 858: 856: 850: 849: 847: 846: 840: 838: 834: 833: 831: 830: 825: 819: 817: 813: 812: 810: 809: 804: 799: 794: 789: 784: 778: 776: 774:Shell builtins 770: 769: 767: 766: 761: 756: 751: 746: 741: 736: 731: 726: 721: 716: 711: 706: 701: 696: 691: 686: 681: 676: 671: 666: 661: 656: 651: 646: 641: 636: 631: 626: 621: 615: 613: 609: 608: 606: 605: 600: 595: 590: 585: 580: 575: 570: 565: 559: 557: 553: 552: 550: 549: 544: 539: 534: 529: 524: 519: 514: 508: 506: 502: 501: 499: 498: 493: 488: 483: 478: 473: 468: 463: 458: 453: 448: 443: 438: 433: 428: 423: 418: 413: 408: 403: 398: 393: 388: 383: 378: 373: 367: 365: 361: 360: 357:shell builtins 348: 346: 345: 338: 331: 323: 317: 316: 311: 306: 302:User Commands 287: 286:External links 284: 283: 282: 275: 272: 271: 270: 262: 254: 243: 235: 225: 222: 204: 190: 188: 185: 179: 177: 174: 135: 134: 129: 123: 122: 117: 111: 110: 105: 99: 98: 85: 79: 78: 65: 61: 60: 49: 43: 42: 39: 26: 24: 14: 13: 10: 9: 6: 4: 3: 2: 1013: 1002: 999: 998: 996: 981: 980: 971: 967: 964: 962: 959: 958: 957: 949: 948: 945: 939: 936: 934: 931: 929: 926: 924: 921: 919: 916: 914: 911: 909: 906: 905: 903: 901:Miscellaneous 899: 893: 890: 888: 885: 883: 880: 878: 875: 873: 870: 868: 865: 863: 860: 859: 857: 855: 851: 845: 842: 841: 839: 837:Documentation 835: 829: 826: 824: 821: 820: 818: 814: 808: 805: 803: 800: 798: 795: 793: 790: 788: 785: 783: 780: 779: 777: 775: 771: 765: 762: 760: 757: 755: 752: 750: 747: 745: 742: 740: 737: 735: 732: 730: 727: 725: 722: 720: 717: 715: 712: 710: 707: 705: 702: 700: 697: 695: 692: 690: 687: 685: 682: 680: 677: 675: 672: 670: 667: 665: 662: 660: 657: 655: 652: 650: 647: 645: 642: 640: 637: 635: 632: 630: 627: 625: 622: 620: 617: 616: 614: 610: 604: 601: 599: 596: 594: 591: 589: 586: 584: 581: 579: 576: 574: 571: 569: 566: 564: 561: 560: 558: 554: 548: 545: 543: 540: 538: 535: 533: 530: 528: 525: 523: 520: 518: 515: 513: 510: 509: 507: 503: 497: 494: 492: 489: 487: 484: 482: 479: 477: 474: 472: 469: 467: 464: 462: 459: 457: 454: 452: 449: 447: 444: 442: 439: 437: 434: 432: 429: 427: 424: 422: 419: 417: 414: 412: 409: 407: 404: 402: 399: 397: 394: 392: 389: 387: 384: 382: 379: 377: 374: 372: 369: 368: 366: 362: 358: 355:programs and 354: 351: 344: 339: 337: 332: 330: 325: 324: 321: 315: 312: 310: 307: 305: 301: 295: 290: 289: 285: 281: 278: 277: 273: 268: 263: 260: 255: 252: 250: 244: 241: 236: 233: 228: 227: 223: 221: 213: 203: 201: 194: 186: 183: 175: 173: 166: 160: 156: 145: 141: 133: 130: 128: 124: 121: 118: 116: 112: 109: 106: 104: 100: 96: 86: 84: 80: 66: 62: 53:Mike Coleman, 50: 48: 44: 40: 38: 34: 19: 977: 955: 264: 256: 248: 245: 237: 229: 208: 197: 181: 164: 139: 138: 57:Morty Abzug, 47:Developer(s) 18:Watch (Unix) 364:File system 59:Jarrod Lowe 956:Categories 93:/procps-ng 83:Repository 816:Searching 505:Processes 314:procps-ng 224:Arguments 200:processes 151:procps-ng 108:Unix-like 41:Tony Rems 995:Category 624:basename 294:watch(1) 274:See also 132:GPLv2.1+ 729:strings 649:dirname 573:logname 522:crontab 191:watch " 187:Example 182:command 180:watch 155:command 127:License 120:Command 95:/procps 72: ( 709:printf 634:csplit 376:chattr 309:procps 304:Manual 176:Syntax 147:procps 89:gitlab 933:sleep 887:strip 867:ctags 802:unset 782:alias 764:xargs 744:troff 704:patch 699:paste 674:iconv 603:write 593:uname 496:umask 486:touch 476:split 471:rmdir 446:mkdir 431:fuser 396:cksum 391:chgrp 386:chown 381:chmod 300:Linux 170:sh -c 144:Linux 140:watch 31:watch 979:List 918:expr 892:yacc 877:make 828:grep 823:find 807:wait 797:test 792:echo 749:uniq 734:tail 724:sort 714:read 689:more 679:join 669:head 664:fold 644:diff 629:comm 588:tput 583:talk 578:mesg 568:exit 547:time 537:nice 532:kill 491:type 426:file 350:Unix 249:secs 165:secs 149:and 115:Type 91:.com 74:1991 67:1991 913:cal 872:lex 844:man 719:sed 639:cut 619:awk 598:who 563:env 481:tee 461:pwd 456:pax 401:cmp 371:cat 247:-n 163:-n 997:: 928:od 923:lp 908:bc 882:nm 862:ar 787:cd 759:wc 754:vi 739:tr 694:nl 684:m4 659:ex 654:ed 542:ps 527:fg 517:bg 512:at 466:rm 451:mv 441:ls 436:ln 421:df 416:du 411:dd 406:cp 266:-v 258:-t 239:-h 231:-d 218:ps 214:-l 212:ls 193:ps 342:e 335:t 328:v 76:) 20:)

Index

Watch (Unix)
Original author(s)
Developer(s)
Repository
gitlab.com/procps-ng/procps
Operating system
Unix-like
Type
Command
License
GPLv2.1+
Linux
command
standard output
ps
processes
ls
List of Unix commands
watch(1)
Linux
Manual
procps
procps-ng
v
t
e
Unix
command-line interface
shell builtins
cat

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.