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'm using ksh on unix and connect through putty.

My .sh_history stores all history commands but when I press up arrow nothing comes, please help me.

share|improve this question

migrated from stackoverflow.com Jun 30 '11 at 14:22

This question came from our site for professional and enthusiast programmers.

Do your arrow keys work in any other programs? –  sarnold Jun 29 '11 at 11:07
history is working, but you key mappings get screwed up, don't know ksh to help you with a proper answer –  Fredrik Pihl Jun 29 '11 at 11:07
my arrow keys are working fine. i guess they are not mapped properly. also i don have .kshrc file –  Praveen Jun 29 '11 at 11:27

3 Answers 3

It happened to me, when I'd press any arrow key some strange characters would come when i connect to a remote machine using putty. I don't know why it happened but the remedy is, you have to type the following in the command line.

$ stty -erase backspace enter

i dont remember what is the prompt of ksh($ or #)

EDIT: i found this link,hope this helps:

Make Arrow and delete keys work in Korn shell Command line

share|improve this answer
when i try stty -erase backspace enter, it says erase not a valid option for stty –  Praveen Jun 29 '11 at 11:20
try stty erase bskp enter –  Aditya Kumar Jun 29 '11 at 11:33
no luck dude. but it made my backspace key not wrking –  Praveen Jun 29 '11 at 11:39
wait lemme try now... it's been a while so, a few combinations coming to my mind... i'll get back to you –  Aditya Kumar Jun 29 '11 at 11:47
stty erase ctrl+v bksp enter.... ctrl+v then backspace will show ^H on the terminal then press enter –  Aditya Kumar Jun 29 '11 at 11:55

set -o emacs should do the trick. The default config doesn't set the editing mode.

share|improve this answer
i tried set -o emacs but no luck its still the same. nothing comes when i press up arrow –  Praveen Jun 29 '11 at 11:19
HISTFILE and HISTSIZE are set in the shell? and it's keeping the contents as you type? You've checked that the Terminal->Keyboard settings for the function keys are 'ESC[n~' and what is the ksh version? –  Petesh Jun 29 '11 at 12:09
my version is M-11/16/88f. HISTFILE and HISTSIZE are set. HISTSIZE is 1024 and HISTFILE is /home/user/.sh_history. also the recalling of commands using escape and k is wrking. i would like to change it to up arrow like c shell. kindly help me –  Praveen Jun 29 '11 at 13:07

Pretty sure the up arrow is a function of bash rather than history (ie: if you have history enabled in ksh or csh it won't work..)

You can either type "bash" once you connect or change the default shell of that user to /bin/bash

share|improve this answer

Your Answer


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