How can I split an output of a command to two terminals? one will get stdout and the other will get stderr. The best I could do is:
On first terminal:

command args 2> errors

and on second terminal

while 1
    cat errors
    sleep 1

This works ok but it prints the errors over and over again every time, is there any better way to redirect the errors to another terminal?


I don't know if this is 100 % correct.

Do the same thing on the first terminal, and on the second terminal don't use a "while" at all. Use tail -f errors to tail the errors file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.