關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • Linux – 檢視指令的輸出變化

    Posted on February 4th, 2006 Sam Tang No comments

    有些時候當需要將一個指令不斷執行,以觀看輸出結果時,這是一件相當累的事情,即使只需按 “上” 鍵執行前一道指令也需人手工件。

    最近發現可以用 watch 來解決,watch 會不斷更新輸出結果,使用方法如下:

    $watch “your-command”

    這時 watch 就會用以預設值每隔 2 秒更新一次結果,如果需要更改更新時間,可以用 -d 選項,以下例子會每秒更新結果:

    $watch -n1 “your-command”


    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word