Scroll to navigation

STDBUF(1) 用户命令 STDBUF(1)

名称

stdbuf - 运行给定的命令,同时改变该命令对应标准输入输出流的缓冲操作配置。

概述

stdbuf 选项... 命令

描述

运行给定的命令,同时改变该命令对应标准输入输出流的缓冲操作配置。

必选参数对长短选项同时适用。

调整标准输入流缓冲区
调整标准输出流缓冲区
调整标准错误流缓冲区
显示此帮助信息并退出
显示版本信息并退出

若模式是 "L",则相应的流将是行缓冲模式。标准输入流下此选项无效。

若模式是 "0",则相应的流将不缓冲。

Otherwise MODE is a number which may be followed by one of the following: KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y. Binary prefixes can be used, too: KiB=K, MiB=M, and so on. In this case the corresponding stream will be fully buffered with the buffer size set to MODE bytes.

注意:若指定的命令调整了其自身的标准流缓冲区(例如 tee 命令),则此操作会覆盖由 "stdbuf" 工具所做出的相应设置。还有某些过滤器程序(如 "dd" 和 "cat" 之类)不使用输入输出流,因此不受 "stdbuf" 设置的影响。

范例

tail -f access.log | stdbuf -oL cut -d ' ' -f1 | uniq
这样会立刻显示 access.log 中独特的条目。

BUGS

在基于 GLIBC 的平台上,指定缓冲大小(即使用全缓冲模式)通常会导致未定义的操作。

作者

由 Padraig Brady 编写。

报告错误

GNU coreutils 的在线帮助: <https://www.gnu.org/software/coreutils/>
请向 <https://translationproject.org/team/zh_CN.html> 报告翻译错误。

版权

Copyright © 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

参见

完整文档请见: <https://www.gnu.org/software/coreutils/stdbuf>
或者在本地使用: info '(coreutils) stdbuf invocation'

本页面中文版由中文 man 手册页计划提供。
中文 man 手册页计划:https://github.com/man-pages-zh/manpages-zh

2020年三月 GNU coreutils 8.32