【问题标题】:keep running process/refresh in bash在 bash 中继续运行进程/刷新
【发布时间】:2011-10-11 06:06:19
【问题描述】:

我想关注特定命令的输出,比如ps aux | grep guest

我正在等待它改变。有什么方法可以像 tail 命令对文件执行的操作一样吗?

最大

【问题讨论】:

    标签: bash process tail


    【解决方案1】:

    您正在寻找:

    watch "ps aux | grep guest"
    

    【讨论】:

    • 哇。没有wayyyyyyyyyy!如何指定间隔?
    • @tekknolagi:使用--interval 标志。
    • @tekknolagi:你可以使用-n seconds。来自手册页:watch runs command repeatedly, displaying its output and errors (the first screenfull). This allows you to watch the program output change over time. By default, the program is run every 2 seconds; use -n or --interval to specify a different interval. Normally, this interval is interpreted as the amout of time between the completion of one run of command and the beginning of the next run. However, with the -p or --precise option, you can make watch attempt to run command every interval seconds.
    • 一个简单的watch ps 如果您没有太多进程(可以同时监控每个进程)也可以正常工作。
    猜你喜欢
    • 1970-01-01
    • 2014-05-12
    • 2015-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-01
    • 1970-01-01
    相关资源
    最近更新 更多