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.

| |
  • 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

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

| |
  • 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.

| |
  • 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

| |

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.