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