$ echo "Process substitution is fun" | tee >(rev)
Process substitution is fun
nuf si noitutitsbus ssecorP $ echo "Process substitution is fun" | tee >(rev)
Process substitution is fun
nuf si noitutitsbus ssecorP sudo echo "fs.inotify.max_user_watches=1000000" > /etc/sysctl.conf
as the redirection happens within the shell, thus without root permissions. However, the following does work: echo "fs.inotify.max_user_watches=1000000" | sudo tee /etc/sysctl.conf
as the writing is done by the elevated tee process.You could get a similar effect in other ways (e.g., tail -f, or terminal scrollback), but I find tee is convenient.
long_running_thing | tee long_running_thing_stdout
and want to see the first few lines of output before going to do something else. The pipe causes buffering on stdout, though, so I have to sit there until 4k of output has come out on stdout.As seen on https://unix.stackexchange.com/questions/25372/turn-off-buff... , either `unbuffer long_running_thing` or `stdbuf -oL long_running_thing` causes it to output linewise instead of 4k at a time.