peet(1)

πŸ“¦
version 2.6.2 Β· 2 versions
, in alpine 3.24, debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– peet β€” piped reverse tee, but make it bestie energy πŸ’–

okay so this is the manual for peet, which lives in section 1 of the manual (that's the "User Commands" section, iykyk). It's a little tool that reads from a whole pile of file descriptors and copies literally everything into one single file descriptor. Reverse tee. Tee but backwards. It's giving unhinged plumbing in the best way πŸ’…


✨ NAME ✨

peet β€” piped reverse tee: read from many file descriptors and copy to one 🫢


🌸 SYNOPSIS 🌸

peet [-h] [-b size] [-w outfd] infd1 [infd2 ...]

like. that's it. that's the whole vibe.


πŸ¦‹ DESCRIPTION πŸ¦‹

So peet reads from a bunch of file descriptors and copies all of it to one file descriptor. And if you don't hand it a file descriptor to write to (aka you skip the -w option), it just defaults to 1, which is stdout. Classic. Reliable. Iconic.

Now here's the tea β˜• β€” peet without the -b option reads whatever data is available on each fd and writes it straight out to the output file descriptor. For each input fd, one read happens. That read grabs a maximum of 4096 bytes at a time. And for each read, one write happens.

⚠️ bestie listen β€” this means the output data might be scattered randomly between the different input streams. It's not gonna come out all neat and ordered. It's a chaos girlie and that's the deal.

When you do specify the -b option, that number is seen as bytes in a block. A write only gets executed when there are complete blocks in the input buffer. So it waits for full blocks before it ships anything out. Patient queen. πŸ‘‘

And fun fact: peet can be used together with pipexec(1) to de-multiplex text based output. Very slay, very demux. 🌈


πŸ’… OPTIONS πŸ’…

  • -h β€” print help and version information. the little "hi bestie here's what I do" moment ✨
  • -b num β€” Reads always num bytes before writing them. waits for the full block, no crumbs πŸ“
  • -w outfd β€” use the given outfd as output file descriptor. If this option is not specified, 1 (stdout) is used. the default is always the default fr fr

πŸŽ€ EXAMPLES πŸŽ€

Example one: read from stdin (fd 0), and file descriptors 9 and 11 and write to stdout. πŸ¦‹

peet 0 9 11

Example two: using pipexec(1). Start two commands, both write their log to stdout, and use one instance of rotatelogs(1) to write the logs to disk into a common log file. (The file descriptors 8 and 11 are chosen by random β€” random queen behavior, no notes.) πŸ’œ

pipexec [ CMD1 /usr/bin/cmd1 ] [ CMD2 /usr/bin/cmd2 ] \
  [ PEET /usr/bin/peet 8 11 ] \
  [ RLOGS /usr/bin/rotatelogs /var/log/%Y%m%d_cmd.log ] \
  "{CMD1:1>PEET:8}" "{CMD2:1>PEET:11}" \
  "{PEET:1>RLOGS:0}"

like look at that. two commands, one peet, one rotatelogs, all holding hands. the file descriptor wiring is giving main character energy and honestly? obsessed. 🫢


🌟 SEE ALSO 🌟

pipexec(1), peet(1), rotatelogs(1), tee(1)

(yes peet(1) is in the SEE ALSO of peet(1). self-love. we stan a confident manual page. πŸ’–)


πŸ‘‘ AUTHOR πŸ‘‘

Written by Andreas Florath (andreas@florath.net) β€” thank you for the gift, king ✨


Copyright Β© 2015,2023 by Andreas Florath (andreas@florath.net). License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.


ok that's the whole page, you're fully caught up, no cap 🧚

and that's a wrap on the User Commands version, dated 2023-03-27, page peet(1) β€” go forth and reverse-tee responsibly, bestie πŸ’–πŸŒΈπŸ’…

πŸ“¦ where this page comes from