Fix Bash Keybindings for Home, End and other keys

terminal.png

Log into a linux box often and find that Home, End, Delete or Ctrl+Arrow keys don’t work?  Well here’s the fix.  Place the following in your ~/.inputrc file

“\e[7~”: beginning-of-line #home
“\e[8~”: end-of-line #end
“\e[3~”: delete-char #delete
“\eOd”: backward-word #ctl-leftarrow
“\eOc”: forward-word #ctl-rightarrow

And then exit bash and reopen a new bash session.

Secondly, if you’re on a machine with multiple (command-line) users, then it makes little sense for everyone to have to create the same “~/.inputrc” file. You need only create one file with those readline settings in it, I suggest “/usr/local/etc/inputrc“, and then point everyone to it by putting this line into “/etc/profile“:

export INPUTRC=’/usr/local/etc/inputrc’

Related Posts

Comments are closed.