Solaris Home/End keys not working like Debian / Ubuntu

solaris

I'm using putty for connecting to a solaris system.

I'm just a user (no root access). All what I know about the system is

Oracle Corporation SunOS 5.11 11.1 January 2014

My problem is comming from the keyboard settings. The keys insert/home/pageup/pagedown/end/delete are all displaying ~ instead of moving the cursor like in Ubuntu.

I already tried lot of tricks found on internet but nothing is working.

echo $TERM gives xterm and putty is well configured with xterm.

I don't know what to do.

Best Answer

To support alternative key mappings you can use the GNU readline library's inputrc init file.

Each user can have their own .inputrc file in their home directory. Or use global /etc/inputrc to set it for all users.


To check the current key map, enter verbatim mode (Ctrl-v) followed by the key to map. This will prevent the shell from parsing and executing the key and provide the key sequence.

E.g.

Ctrl-v Home
^[[1~

The ^[ sequence is equivalent to the [Esc] key, so needs to be mapped as e\.

To test a new map use the bind command:

bind '"\e[1~": beginning-of-line'

Once this works, you can either add the bind command to your shell profile or add all the maps to your .inputrc file.


For Debian / Ubunutu based key mappings, add the following into your personal ~/.inputrc file:

# for linux console and RH/Debian xterm
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# commented out keymappings for pgup/pgdown to reach begin/end of history
#"\e[5~": beginning-of-history
#"\e[6~": end-of-history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word

Then log in again or start a new shell.

Related Question