Linux 常用命令之 watch
目錄
常見命令參數說明
命令選項
|
英文說明
|
中文描述
|
-d, --differences [permanent]
|
Highlight the differences between successive updates. Option will read optional argument that changes highlight to be permanent, allowing to see what has changed at least once since first iteration.
|
高顯示命令結果的差異部分
|
-t, --no-title
|
Turn off the header showing the interval, command, and current time at the top of the display, as well as the following blank line.
|
不在頁面的頭部展示花哨的部分,顯示的內容全是乾貨,是命令結果
|
-n, --interval seconds
|
Specify update interval. The command will not allow quicker than 0.1 second interval, in which the smaller values are converted.
|
指定命令的刷新間隔時間,單憑是 秒
|
-h,-v
|
|
命令幫助和查詢watch版本
|
案例展示
1.純淨的watch + 命令
可以看出,默認是2s刷新一次命令的運行結果的,然後顯示窗口的頭部有時間和日期及命令的說明等花哨的東西
[root@localhost ~]# watch 'date +"%Y年%m月%d日 %H:%M:%S %A 本年度:第 %U 周,第 %j 天"'
Every 2.0s: date +"%Y年%m月%d日 %H:%M:%S %A 本年度:第 %U 周,第 %j 天" Sun May 10 11:57:30 2020
2020年05月10日 11:57:30 星期日 本年度:第 19 周,第 131 天
2.watch+常用參數
[root@localhost ~]# watch -d -t -n 3 'date +"%Y年%m月%d日 %H:%M:%S %A 本年度:第 %U 周,第 %j 天"'
2020年05月10日 12:02:01 星期日 本年度:第 19 周,第 131 天