How to reroute stdout, stderr back to /dev/tty

Sergey picture Sergey · Jan 24, 2012 · Viewed 31.1k times · Source

I just ssh-ed to some remote server and found that stdout and stderr of all commands/processes I am trying to run in bash is redirected to somewhere. So, I got following questions

How to detect:

1) Which file stdout, stderr is beeing rerouted in Linux?

and

2) And how reroute by default stdout and stderr back to /dev/tty?

Thank you in advance.

Answer

zwol picture zwol · Jan 24, 2012

A command that should do literally what you asked for in (2) is

exec >/dev/tty 2>&1

But I suspect that your analysis of the problem is incorrect. It would be useful to see the output of ssh -v ... (where ... is whatever arguments you typed in your original ssh command).