Click to See Complete Forum and Search --> : Enable backspace character


gcutter
12-17-2004, 04:05 PM
I'm a newbie! How do I make the backspace or delete key delete?

Choozo
12-17-2004, 04:38 PM
Generally, you just hit those keys ...

I have no clue about where you are having problems with this .... CLI, editors, ... and which distro/version you have there :confused:

gcutter
12-17-2004, 04:42 PM
Originally posted by Choozo
Generally, you just hit those keys ...

I have no clue about where you are having problems with this .... CLI, editors, ... and which distro/version you have there :confused:


I am using Linux version 2.4 and I am in the CLI. I type a command and I make a mistake. I need to be able to delete the characters. I am not sure what this is called.

retsaw
12-17-2004, 04:53 PM
What distro are you using?

I've had this problem myself, but I can't remember what I did to fix it.

gcutter
12-17-2004, 04:57 PM
Originally posted by retsaw
What distro are you using?

I've had this problem myself, but I can't remember what I did to fix it.

I don't know what that is but, I found the problem. The keybord is just screwy. Thanks for your help!

ernieg
12-17-2004, 09:43 PM
Sometimes you will get funky keyboards or terminal settings. There is a command called stty.

Typically, for instance, when you press the backspace key but all you get is a ^H or a ^? simply run the following command at the prompt:

# stty erase ^H (Where ^H is the actual backspace key)

That will set the "tty" setting from the keyboard to accept the control character from the backspace key to use to REALLY backspace on the comand line.
Run "man stty" for more info on that command

Hope this helps.

fatTrav
12-18-2004, 01:38 AM
In your shell's dot-rc file (.bashrc, .zshrc, whatever) put the following to get the keys working right. This gets the backspace and delte keys to work in less, more, sftp, and other things.


bindkey "^[[2~" yank ## backspace
bindkey "^[[3~" delete-char ## delete
bindkey "^[[5~" up-line-or-history ## PageUp
bindkey "^[[6~" down-line-or-history ## PageDown
bindkey "^[OH" beginning-of-line ## home
bindkey "^[OF" end-of-line ## end
bindkey "^[e" expand-cmd-path
bindkey "^[[A" up-line-or-search ## up arrow for back-history-search
bindkey "^[[B" down-line-or-search ## down arrow for fwd-history-search
bindkey " " magic-space ## do history expansion on space

stty erase `tput kbs`
stty erase '^?'


If you use vim, put this in your .vimrc file to get things workin there

" Some systems fudge the keybindings when dealing with xterm.
" This fixes it.
if &term == "xterm"
set t_kb=^?
fixdel
endif


Aside - when you were asked what version you were using, you replied with your linux kernel version (which is 2.4) and not the distro you use. Generally when someone asks "which version of linux" you reply with the distribution you use(Slackware 10, Redhat 9, Mandrake 10.1, whatever). However technically that is incorrect as "linux" is really only the kernel. I just wanted to clear this up for future posts and such.