xref: /dflybsd-src/usr.bin/stdbuf/stdbuf.1 (revision ec21d9fbfac028108ef0d30283d74b804e16da33)
1*ec21d9fbSAaron LI.\" Copyright (c) 2012 Jeremie Le Hen <jlh@FreeBSD.org>
2*ec21d9fbSAaron LI.\" All rights reserved.
3*ec21d9fbSAaron LI.\"
4*ec21d9fbSAaron LI.\" Redistribution and use in source and binary forms, with or without
5*ec21d9fbSAaron LI.\" modification, are permitted provided that the following conditions
6*ec21d9fbSAaron LI.\" are met:
7*ec21d9fbSAaron LI.\" 1. Redistributions of source code and documentation must retain the above
8*ec21d9fbSAaron LI.\"    copyright notice, this list of conditions and the following disclaimer.
9*ec21d9fbSAaron LI.\" 2. Redistributions in binary form must reproduce the above copyright
10*ec21d9fbSAaron LI.\"    notice, this list of conditions and the following disclaimer in the
11*ec21d9fbSAaron LI.\"    documentation and/or other materials provided with the distribution.
12*ec21d9fbSAaron LI.\"
13*ec21d9fbSAaron LI.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14*ec21d9fbSAaron LI.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*ec21d9fbSAaron LI.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*ec21d9fbSAaron LI.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17*ec21d9fbSAaron LI.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*ec21d9fbSAaron LI.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*ec21d9fbSAaron LI.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*ec21d9fbSAaron LI.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*ec21d9fbSAaron LI.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*ec21d9fbSAaron LI.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*ec21d9fbSAaron LI.\" SUCH DAMAGE.
24*ec21d9fbSAaron LI.\"
25*ec21d9fbSAaron LI.\" $FreeBSD$
26*ec21d9fbSAaron LI.\"
27*ec21d9fbSAaron LI.Dd January 1, 2021
28*ec21d9fbSAaron LI.Dt STDBUF 1
29*ec21d9fbSAaron LI.Os
30*ec21d9fbSAaron LI.Sh NAME
31*ec21d9fbSAaron LI.Nm stdbuf
32*ec21d9fbSAaron LI.Nd change standard streams initial buffering
33*ec21d9fbSAaron LI.Sh SYNOPSIS
34*ec21d9fbSAaron LI.Nm
35*ec21d9fbSAaron LI.Op Fl e Ar bufdef
36*ec21d9fbSAaron LI.Op Fl i Ar bufdef
37*ec21d9fbSAaron LI.Op Fl o Ar bufdef
38*ec21d9fbSAaron LI.Op Ar command Op ...
39*ec21d9fbSAaron LI.Sh DESCRIPTION
40*ec21d9fbSAaron LI.Nm
41*ec21d9fbSAaron LIis used to change the initial buffering of standard input,
42*ec21d9fbSAaron LIstandard output and/or standard error streams for
43*ec21d9fbSAaron LI.Ar command .
44*ec21d9fbSAaron LIIt relies on
45*ec21d9fbSAaron LI.Xr libstdbuf 3
46*ec21d9fbSAaron LIthat is preloaded and configured by
47*ec21d9fbSAaron LI.Nm
48*ec21d9fbSAaron LIthrough environment variables.
49*ec21d9fbSAaron LI.Pp
50*ec21d9fbSAaron LIThe options are as follows:
51*ec21d9fbSAaron LI.Bl -tag -width Ds
52*ec21d9fbSAaron LI.It Fl e Ar bufdef
53*ec21d9fbSAaron LISet initial buffering of the standard error stream for
54*ec21d9fbSAaron LI.Ar command
55*ec21d9fbSAaron LIas defined by
56*ec21d9fbSAaron LI.Ar bufdef
57*ec21d9fbSAaron LI.Pq see Sx BUFFER DEFINITION .
58*ec21d9fbSAaron LI.It Fl i Ar bufdef
59*ec21d9fbSAaron LISet initial buffering of the standard input stream for
60*ec21d9fbSAaron LI.Ar command
61*ec21d9fbSAaron LIas defined by
62*ec21d9fbSAaron LI.Ar bufdef
63*ec21d9fbSAaron LI.Pq see Sx BUFFER DEFINITION .
64*ec21d9fbSAaron LI.It Fl o Ar bufdef
65*ec21d9fbSAaron LISet initial buffering of the standard output stream for
66*ec21d9fbSAaron LI.Ar command
67*ec21d9fbSAaron LIas defined by
68*ec21d9fbSAaron LI.Ar bufdef
69*ec21d9fbSAaron LI.Pq see Sx BUFFER DEFINITION .
70*ec21d9fbSAaron LI.El
71*ec21d9fbSAaron LI.Sh BUFFER DEFINITION
72*ec21d9fbSAaron LIBuffer definition is the same as in
73*ec21d9fbSAaron LI.Xr libstdbuf 3 :
74*ec21d9fbSAaron LI.Bl -tag -width size -offset indent
75*ec21d9fbSAaron LI.It Qq 0
76*ec21d9fbSAaron LIunbuffered
77*ec21d9fbSAaron LI.It Qq L
78*ec21d9fbSAaron LIline buffered
79*ec21d9fbSAaron LI.It Qq B
80*ec21d9fbSAaron LIfully buffered with the default buffer size
81*ec21d9fbSAaron LI.It Ar size
82*ec21d9fbSAaron LIfully buffered with a buffer of
83*ec21d9fbSAaron LI.Ar size
84*ec21d9fbSAaron LIbytes (suffixes 'k', 'M' and 'G' are accepted)
85*ec21d9fbSAaron LI.El
86*ec21d9fbSAaron LI.Sh EXAMPLES
87*ec21d9fbSAaron LIIn the following example, the stdout stream of the
88*ec21d9fbSAaron LI.Xr awk 1
89*ec21d9fbSAaron LIcommand
90*ec21d9fbSAaron LIwill be fully buffered by default because it does not refer
91*ec21d9fbSAaron LIto a terminal.
92*ec21d9fbSAaron LI.Nm
93*ec21d9fbSAaron LIis used to force it to be line-buffered so
94*ec21d9fbSAaron LI.Xr vmstat 8 Ns 's
95*ec21d9fbSAaron LIoutput will not stall until the full buffer fills.
96*ec21d9fbSAaron LI.Bd -literal -offset indent
97*ec21d9fbSAaron LI# vmstat 1 | stdbuf -o L awk '$NF > 1' | cat -n
98*ec21d9fbSAaron LI.Ed
99*ec21d9fbSAaron LI.Sh SEE ALSO
100*ec21d9fbSAaron LI.Xr libstdbuf 3 ,
101*ec21d9fbSAaron LI.Xr setvbuf 3
102*ec21d9fbSAaron LI.Sh HISTORY
103*ec21d9fbSAaron LIThe
104*ec21d9fbSAaron LI.Nm
105*ec21d9fbSAaron LIutility first appeared in
106*ec21d9fbSAaron LI.Fx 8.4 ,
107*ec21d9fbSAaron LIand was imported to
108*ec21d9fbSAaron LI.Dx 5.9 .
109*ec21d9fbSAaron LI.Sh AUTHORS
110*ec21d9fbSAaron LI.An -nosplit
111*ec21d9fbSAaron LIThe original idea of the
112*ec21d9fbSAaron LI.Nm
113*ec21d9fbSAaron LIcommand comes from
114*ec21d9fbSAaron LI.An Padraig Brady
115*ec21d9fbSAaron LIwho implemented it in the GNU coreutils.
116*ec21d9fbSAaron LI.An Jeremie Le Hen
117*ec21d9fbSAaron LIimplemented it on
118*ec21d9fbSAaron LI.Fx .
119