Redhat linux terminal garbage output when using telnet

08
2014-07
  • Dinesh

    I am using redhat-linux terminal to connect to a router device by means of 'telnet'.

    While the device boots, the characters are getting printed in garbage manner which is as follows,

    redhar linux terminal output while telnet

    In terminal, If I click on the the menu 'Terminal'--> 'Reset', then it is getting changed to proper alphabetical.

    Is there any way available to prevent it ?

    I have tried setting the encoding of the terminal to UTF-8 from the menu options. But, still the same issue.

  • Answers
  • lornix

    You stated this output happens when the device is BOOTING, right?

    From the output, it looks like your terminal is receiving a CTRL-N sequence, also known as a SHIFT-OUT (SO) character, flipping your character set to the Alternate Character Set (G1). This is why the terminal reset restores readability for you. (a few years... you'll be able to read that gibberish!) You should be able to flip back to the default charset (G0) by sending a CTRL-O (Oooh, not zero) (SHIFT-IN (SI)).

    echo ^V^O   # or something similar would suffice.
    

    There are other possibilities, but less likely, see here for a decent writeup about what happens and what can be done to restore things without going berserk.

    Basically, your router is sending a SO character, likely not intentionally, but perhaps as line noise or junk during the boot sequence. ({shrug} could be intentional, to scramble the output to deter lookie-loos... but probably not)

    I'm looking for a solution to prevent the shift to the Alt-CharSet... I'll be back...


    EDIT:

    A vt100 terminal reference shows how to redefine the alternate character set (G1) to one of several possible sets, perhaps we could set the G1 (SO) set to be the same as the G0 (SI) set?

    echo -e "\e(B"  # sets G0 to USASCII
    echo -e "\e)B"  # sets G1 to USASCII (default is "\e)0" (zero))
    

    or, as one command:

    echo -e "\e(B\e)B"
    

    This should reset your G1 charset to be readable letters from that point on. Of course, this stymies any attempt to draw cool line-graphics. Bummer. But... it would work.

    alias telnet-router='echo -en "\e(B\e)B"; telnet mr_router; echo -en "\e(B\e)0"'
    

    Set G0/G1, invoke telnet, set G0/G1 to defaults again.

    Of course, one could simply not view the boot output, thus sidestepping the problem entirely... look away!


  • Related Question

    linux - How do I copy data from a Ubuntu server using terminal by telnet?
  • klox

    I have one folder to copy that consists of PHP and similar files for creating a web site.

    How do I copy one folder from the server (Linux Ubuntu) to the client PC (Linux Ubuntu) using terminal? Could I use ftp? For the terminal connection I'm using Telnet.

    The folder location on the server:

    qa@ubuntu:~/www/html/js 
    

    And I want to copy it to the client at:

    qa@desktop2:~/home/qa/html
    

  • Related Answers
  • Steve Robbins

    You can use scp if you have an ssh server running on the remote machine (a good thing to have anyway). Telnet is not good, its unencrypted and bothersome.

    Since I assume you can ssh onto the remote machine, the basic way to use scp is:

    scp -r ~/www/html/js qa@desktop2:~/home/qa/html/js
    

    Assuming that you want to copy from qa@ubuntu:~/www/html/js to qa@desktop2:~/home/qa/html/js scp is pretty powerful, so I suggesting reading the man page for it at

    man scp
    
  • Gareth Williams

    Edit:
    You'll have trouble copying files via telnet my friend :) Why do you insist on using a terminal?
    ie. You're running Windows, so presumably have access to a graphical environment - would using windows file sharing / a web browser / ftp client / ssh client / etc be ruled out because they're graphical? And if so, why?

    Do you have root access on the Ubuntu machine? I would suggest you install an ssh server:
    $ sudo apt-get install openssh-server

    Then grab a windows SSH/SCP client, eg. WinSCP, and use it to log in to the server and copy your files.
    OR: If you really really want to do it via the terminal for some reason, grab Cygwin and install openssh, then use the 'scp' command mentioned below.

    --
    You need to be a little more specific about your situation.
    - what OS is the client running?
    - what OS is the server running?
    - what services is the server running, if you know (FTP, HTTP, NFS, SMB, SSH, etc)

    eg. if you have ssh access to the server, something like this would work:
    scp [email protected]:/remote/path/file.txt /local/path/

    If you have HTTP access to the file (http://server.mydomain.com/path/file.txt) then as the poster above suggested, wget:
    wget http://server.mydomain.com/path/file.txt

    The answer depends heavily on your situation :)

  • SysAdmin1138

    If you're using Windows for this, and you really can't use HTTP in any way to get the file, you can resort to old-school file-transfer over 7-bit ASCII protocols. I'm talking about Z-Modem. It last saw major use over dial-up internet, specifically in the BBS world, with a side-line in unix-to-unix transfers when FTP wasn't available (generally over rsh, but I'm digressing).

    Anyway, to get that directory tree from Windows, without using FTP or HTTP, just terminal.

    1. Telnet to server using HyperTerm.
    2. Tar/Zip up the directories you're interested in.
    3. From the command line,
      sz filename.tar.gz  
    4. From Hyperterm, select Transfer -> Receive File.
    5. Specify your save path, and "Zmodem" as the receiving protocol.

    It won't transfer as fast as FTP or HTTP would, but it'll get you files.

  • goofrider

    It depends on how the file is served. If the file can be downloaded from a web browser, then the "wget" command will work: http://linux.die.net/man/1/wget