I need to use telnet to talk with a socket server which is not a standard Telnet server. I do not want any Telnet negotioation or interference of any kind in the data.

This is available as 'raw mode' in PuTTy and I need the same functionality in Linux.

  • 2
    Do you know netcat? – sr_ Feb 15 '12 at 10:45
  • I added that I need a command line telnet client (so Putty on Linux does not work for me). – Eden Feb 15 '12 at 11:47
  • I am connecting to a MOXA product which is a TCP server for remotely connecting to a serial port (of a legacy product). It needs to be raw so that all keystrokes will be sent as is. – Eden Feb 15 '12 at 12:19
  • Basically I need 'telnet-like' functionality but without the protocol. I also tried netcat (suggested above) but that did not work nicely - it is in line edit mode and keystrokes like ^C are not passed. – Eden Feb 15 '12 at 12:23
  • As another pointer, have a look at socat, it is a lot more feature-packed than netcat; maybe you can utilize it. – sr_ Feb 15 '12 at 12:49

Use netcat, it provides command line raw sockets, a very handy utility, I often use it to move data between servers when encryption is not required, for example:


# nc -l -p 1234 | zcat | mysql -u root databaseName


# mysqldump -u root databaseName | gzip | nc Server1 1234
| improve this answer | |
  • This is an awesome tip! However, when I tried it between two terminal windows on MacOS the first line errored. My man page for nc says it is an error to use -p with -l. It worked like a champ when I omitted the -p – RufusVS Aug 23 '17 at 3:51

At risk of sounding daft, why not just use PuTTY? If you already like the functionality it gives you, just run it. PuTTY is available for Linux or Windows

As already pointed out in comments, telnet isn't raw - it expects certain protocols to be followed.

| improve this answer | |
  • 1
    +1 Rory. Telnet isn't raw. Use 'set options' on the telnet> prompt and you'll see the protocols in action. – Stephen Quan Feb 15 '12 at 10:51
  • Putty "RAW" mode is not really RAW. When you press Enter it sends CR/LF. – eddyq Mar 10 at 15:36

You can use telnet to connect to any port provided that there is something listening to that port and it is not blocked by a firewall.

telnet alt1.aspmx.l.google.com 25
telnet google.com 80

Will all work fine. However, you must know what protocol is used by the other end of the connection otherwise, it is kind of pointless.

Note that telnet sends packets unencrypted.

| improve this answer | |
  • 5
    Beware: telnet seems "raw", but it isn't. There is already some protocol level involved even if limited. What are you trying to achieve here ? – Ouki Feb 15 '12 at 10:21
  • @Ouki, the TELNET protocol is quite complex, sure. The telnet 'program will usually revert to a raw operation mode if not connecting to a TELNET server. – vonbrand Feb 23 at 3:55

Very old, but I found this to work for a MOXA unit:

stty raw && nc <ip> 23 && stty sane
| improve this answer | |

Still relevant after all these years.

This works fine in the ~/.bash_aliases, opening up a moxa shell in a tab without the local echo: (parameter is moxa port number)

function moxat(){
  mate-terminal --tab --title="moxa1 $1" -e "bash -c 'stty raw -echo && \ 
  nc <ip> $1 && stty sane'" 
| improve this answer | |

Use this exact line:

sudo socat tcp-l:2023,reuseaddr,fork exec:/bin/login,pty,setsid,setpgid,stderr,ctty

That will let you connect with a raw socket from the Moxa and get a command line prompt on the host machine. From there you can Telnet or SSH at will to any system with ease.

| improve this answer | |

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.