(TIL) Nix: Duplicate pipe content

less than 1 minute read

To duplicate the content while piping you can use the tee utility. One straightforward and useful example is that tee can be used to write to multiple files at the same time. The command to achieve this is:

ps | tee fileone filetwo filethree

The output of the ps command is now inside three different files. To append data to files, the -a flag must be used:

ps | tee -a fileone filetwo filethree

Via enki.com.

Tags: ,

Categories:

Updated:

Comments