5

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.

1 Answer 1

8

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.

16
  • I tried set -o vi. With home : the cursor go back 1 position on the last character and toggle it uppercase/lowercase. Another home : just toggle the last character.
    – tweetysat
    Oct 15, 2014 at 13:07
  • I tried shift-home and shift-end : still get ~
    – tweetysat
    Oct 15, 2014 at 13:09
  • What does echo $SHELLOPTS give you? Oct 15, 2014 at 13:11
  • echo $SHELLOPTS braceexpand:hashall:histexpand:history:interactive-comments:monitor:vi and (without set -o vi) echo $SHELLOPTS braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
    – tweetysat
    Oct 15, 2014 at 13:13
  • 1
    Try Ctrl-v followed by the Home key to ensure it matches the setting: You should get "^[[1~" which equates to "\e[1~" (substituting the escape). Oct 16, 2014 at 8:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .