multitee(1)
π NAME π
okay so bestie, meet multitee β she's from section 1 of the General Commands Manual, and her whole thing is sending multiple inputs to multiple outputs. no cap, that's literally the job description. π¦
β¨ SYNTAX β¨
multitee [ -bsize ] [ -vQq ] [ fd-fd,fd,fd... ] ...
π DESCRIPTION π
okay so here's the tea. multitee sends multiple inputs to multiple outputs. give her an argument shaped like fdin-fdout,fdout,fdout... and she'll send all the input on file descriptor fdin to each descriptor fdout. she exits when all the fdins are closed. and yes, several arguments can point outputs at the same fdin β she's flexible like that. π
-fdout and ,fdout are equivalent, so pick whichever one your heart wants.
If there's an error of any sort (including SIGPIPE) while writing to fdout, multitee prints a warning on stderr and forgets fdout entirely. (This doesn't affect reads on fdin, bestie β the reading side is untouched.) π
But WAIT, there's a twist: if -fdout gets replaced by :fdout, then multitee will exit upon any SIGPIPEs from that descriptor. so like, that colon is a whole boundary-setting moment. π
Also, efd means that as soon as fdin reaches end of file, fd is considered to reach EOF as well. and if input errors happen, multitee will warn about them and then treat them like EOF. chill of her honestly. β¨
πΈ the blocking behaviour (iykyk) πΈ
Unlike tee, multitee tries her absolute best to keep processing all the descriptors even while some of them are blocked. main character energy, truly.
That said, she will get stuck reading if someone else is reading the descriptor and grabs the input first. she'll also get stuck writing if an input packet does not fit in an output pipe. π«
(If the output descriptor has NDELAY set, and multitee receives EWOULDBLOCK, it writes one byte at a time to avoid pipe synchronization problems. tiny sips, very demure.)
Now, while it is tempting to set the descriptors to non-blocking mode β this is dangerous: other processes using the same open file may not be able to deal with NDELAY. and honestly, it is incredible that none of the major UNIX vendors or standards committees has come up with true per-process non-blocking I/O. like. hello?? π
(Under BSD 4.3 and its variants, multitee could send timer signals to itself rapidly to interrupt any blocking I/O. However, this cannot work under BSD 4.2, and is generally more trouble than it's worth.) π
So: a program can set NDELAY before invoking multitee if it knows that no other processes will use the same open file. that's the green flag scenario, bestie.
multitee will also temporarily stop reading an input descriptor if more than 8192 bytes are pending on one of its output descriptors. This does not affect independent fdin-fdout pairs β they mind their own business. π
π the flags π
multitee has several flags:
-bsizeβ change the input buffer size from8192to size. and unlike the previous version ofmultitee, this version does not require output buffers, and does not copy bytes anywhere betweenread()andwrite(). glow-up confirmed. β¨-vβ Verbose.-qβ Quiet.multiteewill not usestderrin any way (except, of course, if descriptor 2 is specified in an argument). π€«-Qβ Normal level of verbosity.
β EXIT VALUE β
0normally. π1for usage messages.3ifmultiteeruns out of memory.4in various impossible situations. (how?? nobody knows. iconic.) π
π DIAGNOSTICS π
fatal: out of memoryβmultiteehas run out of memory.warning: cannot read descriptorβ Self-explanatory.warning: cannot write descriptorβ Self-explanatory.
π EXAMPLES π
okay bestie, watch and learn:
multitee 0-1,4,5 4>foo 5>bar
Same as tee foo bar except for better blocking behavior. same vibe, upgraded software. π
multitee 0:1 3:1 4:1,2 6:7
Merge several sources into the output, meanwhile copying 6 to 7 and recording 4's input in 2. multitasking queen. π
tcpclient servermachine smtp multitee 0:7 6:1e0
Same as mconnect on Suns. The e0 tells multitee to quit as soon as the network connection closes. so polite, so efficient. β¨
π§ RESTRICTIONS π§
multitee expects all descriptors involved to be open. Currently a closed descriptor acts like an open descriptor which can never be written to. π«Ά (yes, that is as cursed as it sounds.)
π BUGS π
None known. she's perfect, your honour. π
πΈ VERSION πΈ
multitee version 3.0, 7/22/91.
π AUTHOR π
Placed into the public domain by Daniel J. Bernstein. king behaviour, fr fr. π
π SEE ALSO π
and that's the whole page, bestie β she lives in the General Commands Manual as multitee(1), version 3.0, dated 7/22/91. go forth and pipe responsibly. π¦β¨π
π¦ where this page comes from
- debian bookworm: multitee 3.0-6+b1 Β· LicenseRef-public-domain
- debian trixie: multitee 3.0-6.1 Β· LicenseRef-public-domain
- ubuntu jammy: multitee 3.0-6build1 Β· LicenseRef-public-domain
- ubuntu noble: multitee 3.0-6build1 Β· LicenseRef-public-domain
- ubuntu questing: multitee 3.0-6.1
- ubuntu resolute: multitee 3.0-6.1build1 Β· LicenseRef-public-domain
- ubuntu stonking: multitee 3.0-6.2 Β· LicenseRef-public-domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms