【问题标题】:Three | commands in linux terminal [closed]三 | linux终端中的命令[关闭]
【发布时间】:2013-07-03 11:59:45
【问题描述】:

通常在 Linux 命令中,您可以像这样指定另一个要同时运行的命令:

ls | grep "sys" 

例如。就我而言,我有这个命令:

urlsnarf -i wlan0

我可以像这样编辑它以显示过滤后的输出:

urlsnarf -i wlan0 | cut -d\" -f4

但我也想将输出保存到文件并同时在控制台中打印文本,所以我像这样编辑它:

urlsnarf -i wlan0 | cut -d\" -f4 | tee output

但是既没有输出文件也没有打印输出。有没有办法解决这个问题?

【问题讨论】:

标签: linux terminal command


【解决方案1】:

我想这里发生的事情是管道正在被缓冲。之前没见过urlsnarf,不过貌似是一个持续监控的过程。根据以下帖子,您不能轻易阻止管道完全缓冲:

How to make output of any shell command unbuffered?

从一个答案链接的文章很好读:buffering in standard streams

【讨论】:

    猜你喜欢
    • 2020-10-09
    • 2021-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多