Problems on the console

Lars Eighner luvbeastie at
Thu Sep 18 23:51:45 UTC 2008

On Thu, 18 Sep 2008, manish jain wrote:

> Hi,   I am using FreeBSD 6.2 without X/Xorg. My shell is bash and my
> keyboard layout is US-ISO.   I am facing 2 problems on the console :  

> 1) My backspace key works fine, but the Del and Delete keys also do a
> backspace instead of a forward delete. How do I change this ? My
> keyboard is a basic 101/102 keyboard.

This is the unix way.  There are two strings which may be mapped
to the keyboard Delete and Del (keypad . without num lock).

In the default us.iso keymap the Del key (scan 083) is mapped to del, which
is Ctrl-?  The Delete (scan 103) is mapped to fkey61 --- this is also
the string Ctrl-? --- not ^[[E which is the usual string for DOS type
keyboards.  As it happens ^[[E is fkey 54 which is keypad 5 without
num lock.

^? is not the same as backspace (^H), but it seems to be the case that
bash does the same thing with them.

From what is below I cannot tell what TERM you are using or what keys you
are trying to map to which function.  If you are really using the console or
a virtual TTY, the inputrc below is completely screwy.

Mapping ^? to delete-char should get bash to do what you want.  However,
you can expect to have to make some adjustment to nearly every application,
because looks like backspace sort-of is the unix way.  Many applications
do recognize the difference between backspace (^H) and (^?) but do a
backwards delete (not the same as backspace) for ^?.

Generally, since I can become root, I map Delete to fkey54 in
syscons/keymaps/whateverkeymapyouuse.  If you tweak the keymap yourself,
besure to backup up your changes or change the keymap name to something not
otherwise being used because the default keymaps will be reinstalled
everytime you upgrade the system.  Then I map ^[[E to forward-delete
in applications, leaving Del as ^? in case this really does something
desirable in the application.

> 2) Bash simply does not remember
> my commands in the right order. Most of the commands I type in a login
> session are forgotten in the next session. Moving the Up and Down arrow
> keys navigates a mangled and incomplete command history.   I am attaching
> the contents of my .bash_profile, .bashrc and .inputrc below.
> #.bash_profile :
> if [ -f ~/.bashrc ]; then
>  source ~/.bashrc
> fi
> #end-of-file
> #.bashrc :
> export HISTFILE="~/.bash_history"

This is the default

> export HISTFILESIZE=1000
> shopt -s cmdhist
> shopt -s histappend
> #end-of-file
> #.inputrc :
> "\e[1~": beginning-of-line
> "\e[4~": end-of-line
> "\e[3~": delete-char #should be a forward delete unless I am mistaken
> "\eOd": backward-word #ctrl-leftarrow
> "\eOc": forward-word #ctrl-rightarrow

On a pc with an at keyboard with one of the default FBSD TERMs, none of
these strings are sent.

> set completion-query-items 20
> set meta-flag on
> set input-meta on
> set convert-meta off
> set output-meta on
> #end-of-file
> If anyone can help me out, I shall be really grateful.
> Thanks in advance,
> Manish Jain
> goodredhat at

       Unlimited freedom, unlimited storage. Get it now, on
> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

Lars Eighner
8800 N IH35 APT 1191 AUSTIN TX 78753-5266

More information about the freebsd-questions mailing list