Bash – Erase character with BackSpace on a bash command line

bashcommand linekeyboard shortcutsterminal

I have a configuration for bash and profile files, but I copied that file to other server so now I can't erase text only by pushing backspace, I need to press Shift + Backspace to erase text.

What is the parameter I need to change to restore it?

Best Answer

Generally (depending on the conventions for the particular system you are using), the backspace key sends either ASCII BS (^H) and DEL (^?)

Some terminal emulators switch between ASCII BS (^H) and DEL (^?) when you use the shift-modifier. Some do not. Apparently the program you are using for ssh does not.

Given this line from your .profile:

stty erase "^H" kill "^U" intr "^C" eof "^D" susp "^Z"

it seems that your terminal normally sends ^? (ASCII DEL), but you told it to expect ^H (ASCII BS). However, your terminal switches to ^H when you modify backspace with the shift key. You could have used

stty erase "^?" kill "^U" intr "^C" eof "^D" susp "^Z"

and gotten better results.

Related Question