Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arrow keys in Putty returning ^[[A ^[[D ^[[B instead of moving the cursor

Has anyone else ever had this error in PuTTy?

For example, pressing the Up Key now produces:

>>> ^[[A 

Google doesn't let you search for special characters so I'm stumped at finding existing version of this problem.


EDIT:

So this happened after I pasted in some unicode (when, I think, the translation was already set to utf-8).

I've checked the Change Settings dialog box for different settings than my other open PuTTy windows, but the settings appear to be identical.

EDIT2:

This is fixed by restarting PuTTy, but still a nuisance.

EDIT3:

How to replicate the exact same bug:

  1. Open a putty terminal to a linux PC (I'm using RedHat)
  2. Open Python 2.7.* - using the command python2.7 (note: error does not appear in 2.6)
  3. import codecs
  4. Now use the arrow keys, and these bizarre characters appear.
like image 899
LittleBobbyTables Avatar asked Feb 12 '13 16:02

LittleBobbyTables


People also ask

How do you move the cursor in putty?

Left and Right keys move the cursor one single char. Home and end keys move the cursor to the beginning and end of line resp. Ctrl + A and Ctrl + E combos bring my cursor to the beginning and end resp. This is the behaviour I would like for all my shells.

Which arrow key is used to move the cursor?

Certain letter keys, the arrow keys, and the Return key, Back Space (or Delete) key, and the Space Bar can all be used to move the cursor when you're in command mode.

How do I use arrow keys in terminal?

The way to scroll using the arrow keys in a terminal emulator is to hold down the shift key. This is because a terminal emulator send all keypresses to the application running in the terminal; holding shift down bypasses that. This can also be used with other keys like copy and paste.

What is cursor movement keys?

Arrow keys or cursor movement keys are buttons on a computer keyboard that are either programmed or designated to move the cursor in a specified direction.


2 Answers

In my experience that's because "bash" is not running. Simply run "/bin/bash" to enjoy colors, history and more.

like image 116
olvlvl Avatar answered Sep 20 '22 07:09

olvlvl


I've found that specifying "The Function Keys and Keypad" option to match your operating system resolves many issues.

[Putty]

Terminal -> Keyboard --> RadioButton "Linux"

(if you're using Linux) and then you can start your session

like image 25
Michael Cameron Avatar answered Sep 21 '22 07:09

Michael Cameron