Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using putty to SSH into a mac, if I try to edit a file with pico, nano or vi I get an output similar to this:

[username]$ pico textEdit.txt

←)0←7←[?47h←[1;24r←[m←[4l←[?1h←=←[?1h←=←[?1h←=←[?1h←=←[H←[2J←[22B←[7m^G←[m Get Help  ←[7m^O←[m Write
←[1B←[7m^X←[m Exit←[6C←[7m^J←[m Justify   ←[7m^W←[m Where Is  ←[7m^V←[m Next Page ←[7m^U←[m UnCut Tx
t ←[7m^T←[m To Spell  ←[22;35H←[7m[ New File ]←[m←[H←[7m  GNU nano 1.2.4                 File: textEdit.txt ←[1;52H←[m

Are there any settings I can change for either putty or my command prompt to allow a correct display of the output? (I haven't found any)

EDIT: I use plink to open the tunnel, if I open putty the regular way it works just fine

I have seen many solutions of using GUI editors over putty but I'd rather use a shell based editor for quick edits.

share|improve this question
    
Looks like your TERM environment variable is set incorrectly. –  Scott Sep 20 '13 at 1:17

1 Answer 1

up vote 1 down vote accepted

You aren't using PuTTY. You're using plink. There's a difference.

On Windows, the default Console works rather differently than terminals in Unixes – that is, it does not understand ANSI escape sequences at all (and various console-based programs use special API functions to position the cursor or to change colors).

So PuTTY.exe isn't just a SSH client but also a full terminal emulator on its own. Similarly, if you use Cygwin's ssh command, it uses some kind of terminal emulation layer inside cygwin1.dll.

Meanwhile, plink.exe has nothing of that kind, it is a SSH client only. This means that if you run it in the Windows Console, you will always see the raw escape codes as they were originally sent, without any interpretation.

There are three possible solutions:

  • run plink inside a terminal emulator such as MinTTY;

  • install ssh from Cygwin;

  • use PuTTY.exe – it does connect you to a shell; it is a GUI program only to be able to draw advanced terminal features.

share|improve this answer
    
Thanks for the clarification, I thought plink was just a command line version of putty and they had the same features. I guess using the putty terminal is not too much of a bother, at least now I know what the problem was. –  Joakim Sep 20 '13 at 6:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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