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.

Often when using bash I am used to using the keys ^A and ^E to go to the beginning and end of line, and the arrow keys to move from character to character without erasing. Every now and then, I enter certain tools where it completely screws up my hotkeys, and nothing works. My keyboard is remapped making the delete key the backspace key, ^W now erases words and it is impossible for me to correct anything in the command line because just about every key for editing the commands typed puts garbage characters to the terminal. This often happens to me when entering passwords or SQLPlus in a UNIX terminal.

I don't even know if this is bash or something else, but someone told me too look at this command:

  $ stty -a
  speed 38400 baud; rows 37; columns 100; line = 0;
  intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = ^Z;
  start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0
  ;
  -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
  -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel

  opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
  isig icanon iexten echo -echoe -echok -echonl -noflsh -tostop -echoctl -echoke

Anyhow, I don't know what I am looking at here, but I do recognize some of the shortcuts ^W and ^U. How can I redefine things to make this weird terminal settings act like regular bash

share|improve this question

migrated from stackoverflow.com Nov 14 '11 at 11:54

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

3 Answers 3

up vote 0 down vote accepted

Most of what you describe is provided by readline, so if the utility you are using doesn't support readline or something equivalent you are out of luck. The terminal only interprets a very limited set of escape codes, mainly the ones for deleting the previous word (^W) and for deleting the whole line (^U), for the rest (^A, ^E, ...) the application has to do the work.

share|improve this answer

I think you want the reset command, in the ncurses package.

If you rather mean inside of sqlplus, then the other answer is correct: there's nothing you can do, because sqlplus is an ancient and doesn't support readline.

share|improve this answer
2  
I think I misunderstood your question. I thought you meant that your terminal got screwed up outside of sqlplus. If you mean inside of sqlplus, then ninjalj is correct: there's nothing you can do, because sqlplus is an ancient piece of crap that doesn't use readline. –  Andrew Schulman Nov 2 '11 at 13:06

You can use rlwrap

Unfortunately, if you are on client site, you can't compile it. But you can download a binary version here

Have fun!

share|improve this answer

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.