Home and End keys not working
Why don't my Home and End keys work in terminals?
A: This is a common problem that seems to have multiple causes. There may be issues with the readline library, but it seems that the default /etc/inputrc fixes these, at least in emacs mode.
The problem still seems to exist with ncurses based applications including less, nano, and centericq (to name but a few). These do not appear to use the readline library, or do not use the inputrc mappings.
The solution seems to be to have the proper setting of the TERM variable. This may take some experimenting by looking in the /usr/share/terminfo/* directories. Each entry is a potential setting of the TERM variable.
In xterm setting TERM=xterm-color DOES NOT solve the Home/End issues. This is often the default TERM setting people recommend.
However, setting TERM
xterm-xfree86 seems to solve the problem. If you use the linux console instead of a terminal emulator, setting TERMlinux seems to solve the problem. You can do this each time you start a terminal, or export it in your ~/.bashrc file.
Other terminals, including konsole, and rxvt have several entries in the terminfo database that you may need to experiment with. If you find a suitable TERM setting for your favourite terminal, please enter it into this wiki file.
If you use a resource-based terminal such as xterm, rxvt, and aterm, another (better) way of solving the problem is to add
xterm*termName: xterm-xfree86 to your ~/.Xdefaults, and to add
xrdb ~/.Xdefaults to your
If you use KDE's Konsole, you can open the
Settings -> Configure Konsole menu item, click the
Session tab, select
Shell from the
Session list, and change the value of the
$TERM textfield to
Xorg users can try to set the
$TERM value to
xterm-xf86-v40. This one fix the home/end keys and prevent display corruption on nano and maybe other apps.