I am working on embedded product running Linux. The device uses /dev/ttyO0 as console. On boot is automatically start a program with which uses input from /dev/ttyO0 (serial), and gives some information on device status on the serial. I want to redirect /dev/ttyO0 to something I can reach through the network (such as ssh).

I am able to connect by telnet, but I don't see any of the information seen in serial. What can I do for this purpose ?

closed as unclear what you're asking by Anthon, slm Oct 11 '14 at 23:34

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • By “stdout”, you mean the standard output of a program, right? – Gilles Oct 11 '14 at 20:42
  • yes, I do. I have edited the question, can you remove the on hold ? – ransh Oct 12 '14 at 6:52
  • You say you mean the output of a program, but then you've edited to say that data is coming from a serial connection. Which one is it? Please describe the flow of data. Don't just say “input” or “output”, because it isn't clear what this is the input and output of. Tell us what produces the data and what connections it goes over (e.g. a device emits data on a serial line, the data is received by the computer and needs to be forwarded over a TCP connection to a program listening on another machine, and in the other direction etc.) – Gilles Oct 12 '14 at 12:25
  • Hi Giles, I've edited it again, I think it is clearer now. Thx – ransh Oct 12 '14 at 17:07
  • To me it is still unclear what you want. My guess is: The device uses /dev/ttyO0 as the console, and you want to see the console. Thus you want to redirect all data that goes to /dev/ttyO0 to something you can reach through the network (such as ssh). – Ole Tange Oct 12 '14 at 23:41

You don't. Use netcat nc instead. It will do what you want, whereas telnet will not.

(echo helo ole.tange.dk; echo mail from: '<spam@tange.dk>'; echo rcpt to: '<spam@tange.dk>'; echo data; echo Subject: This is an email;echo;echo test;echo .;echo quit ) | nc smtp.server.example.com 25 | grep 250
  • Hi Ole, do you mean it is not possible by connecting with telnet? How do you use nc to redirect stdout to the netcat utility ? – ransh Oct 11 '14 at 19:54
  • What I mean is that I have spent a tremendous amount of time trying to get telnet to behave and have failed. netcat on the other hand worked in first try: echo foo | nc server 23 – Ole Tange Oct 11 '14 at 19:57
  • thanks! I also see the following example as an option: nc www.example.com port < /dev/ttyS0 – ransh Oct 11 '14 at 20:01
  • but still I will need to write the above option from the serial interface, right ? – ransh Oct 11 '14 at 20:11
  • 1
    I am ashamed I have been using Unix/Linux for so long and never new about this utility (netcat)... Excellent! – kevinarpe Feb 12 '17 at 13:24

If you would like to redirect the output to telnet, here is an example:

echo "helo mailhub";
sleep 1;
echo "mail from:<root>";
sleep 1;
echo "rcpt to:<root>";
sleep 1;
echo "data";
sleep 1;
echo "[...]";
echo ".";
sleep 2;
) | telnet mailserver 25


  • Hi Scyld, I've edited my question, I actually need both stdin and stdout. Thx – ransh Oct 12 '14 at 20:14

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