{"id":946,"date":"2019-04-19T16:37:26","date_gmt":"2019-04-19T08:37:26","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=946"},"modified":"2019-04-29T15:26:44","modified_gmt":"2019-04-29T07:26:44","slug":"watch","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/watch","title":{"rendered":"watch\u547d\u4ee4 – \u5468\u671f\u6027\u6267\u884c\u547d\u4ee4"},"content":{"rendered":"\n
watch\u547d\u4ee4\u4ee5\u5468\u671f\u6027\u7684\u65b9\u5f0f\u6267\u884c\u7ed9\u5b9a\u7684\u6307\u4ee4\uff0c\u6307\u4ee4\u8f93\u51fa\u4ee5\u5168\u5c4f\u65b9\u5f0f\u663e\u793a\u3002watch\u662f\u4e00\u4e2a\u975e\u5e38\u5b9e\u7528\u7684\u547d\u4ee4\uff0c\u57fa\u672c\u6240\u6709\u7684Linux\u53d1\u884c\u7248\u90fd\u5e26\u6709\u8fd9\u4e2a\u5c0f\u5de5\u5177\uff0c\u5982\u540c\u540d\u5b57\u4e00\u6837\uff0cwatch\u53ef\u4ee5\u5e2e\u4f60\u76d1\u6d4b\u4e00\u4e2a\u547d\u4ee4\u7684\u8fd0\u884c\u7ed3\u679c\uff0c\u7701\u5f97\u4f60\u4e00\u904d\u904d\u7684\u624b\u52a8\u8fd0\u884c\u3002 <\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>watch [\u53c2\u6570] [\u547d\u4ee4]<\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a\ufeff<\/strong><\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n \u91cd\u590d\u6267\u884cuptime\u547d\u4ee4\uff1a<\/p>\n\n\n\n \u6bcf\u9694\u4e00\u79d2\u9ad8\u4eae\u663e\u793a\u7f51\u7edc\u94fe\u63a5\u6570\u7684\u53d8\u5316\u60c5\u51b5\uff1a<\/p>\n\n\n\n \u6bcf10\u79d2\u4e00\u6b21\u8f93\u51fa\u7cfb\u7edf\u7684\u5e73\u5747\u8d1f\u8f7d\uff1a<\/p>\n\n\n\n \u76d1\u6d4b\u78c1\u76d8inode\u548cblock\u6570\u76ee\u53d8\u5316\u60c5\u51b5\uff1a<\/p>\n\n\n\n \u76d1\u6d4b\u5f53\u524d\u76ee\u5f55\u4e2dtest.txt\u6587\u4ef6\u7684\u53d8\u5316\uff1a<\/p>\n\n\n\n watch\u547d\u4ee4\u4ee5\u5468\u671f\u6027\u7684\u65b9\u5f0f\u6267\u884c\u7ed9\u5b9a\u7684\u6307\u4ee4\uff0c\u6307\u4ee4\u8f93\u51fa\u4ee5\u5168\u5c4f\u65b9\u5f0f\u663e\u793a\u3002watch\u662f\u4e00\u4e2a\u975e\u5e38\u5b9e\u7528\u7684\u547d\u4ee4\uff0c\u57fa\u672c\u6240\u6709\u7684 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/946"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=946"}],"version-history":[{"count":7,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/946\/revisions"}],"predecessor-version":[{"id":1671,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/946\/revisions\/1671"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-n\/--interval<\/td> watch\u9ed8\u8ba4\u6bcf2\u79d2\u8fd0\u884c\u4e00\u4e0b\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u7528-n\u6216-interval\u6765\u6307\u5b9a\u95f4\u9694\u7684\u65f6\u95f4<\/td><\/tr> -d\/--differences<\/td> \u7528-d\u6216--differences \u9009\u9879watch \u4f1a\u9ad8\u4eae\u663e\u793a\u53d8\u5316\u7684\u533a\u57df\u3002 \u800c-d=cumulative\u9009\u9879\u4f1a\u628a\u53d8\u52a8\u8fc7\u7684\u5730\u65b9(\u4e0d\u7ba1\u6700\u8fd1\u7684\u90a3\u6b21\u6709\u6ca1\u6709\u53d8\u52a8)\u90fd\u9ad8\u4eae\u663e\u793a\u51fa\u6765<\/td><\/tr> -t\/--no-title<\/td> \u5173\u95edwatch\u547d\u4ee4\u5728\u9876\u90e8\u7684\u65f6\u95f4\u95f4\u9694\u3001\u547d\u4ee4\u3001\u5f53\u524d\u65f6\u95f4\u7684\u8f93\u51fa<\/td><\/tr> -h\/--help<\/td> \u67e5\u770b\u5e2e\u52a9\u6587\u6863<\/td><\/tr><\/tbody><\/table>\n\n\n\n [root@linuxcool ~]# watch uptime<\/pre>\n\n\n\n
[root@linuxcool ~]# watch -n 1 -d netstat -ant<\/pre>\n\n\n\n
[root@linuxcool ~]# watch -n 10 'cat \/proc\/loadavg'<\/pre>\n\n\n\n
[root@linuxcool ~]# watch -n 1 \"df -i;df\"<\/pre>\n\n\n\n
[root@linuxcool ~]# watch -d 'ls -l|grep test.txt'<\/pre>\n","protected":false},"excerpt":{"rendered":"