Getting ;5D when hitting ctrl + arrow key in a Terminal on FreeBSD
A .inputrc
in your home directory will cause ctrl+left to stop working on Ubuntu (for example).
To get everything working, add the following to ~/.inputrc
:
# Include system-wide inputrc, which is ignored by default when
# a user has their own .inputrc file.
$include /etc/inputrc
If You use ZSH, then use this at /etc/zshrc file.
case "${TERM}" in
cons25*|linux) # plain BSD/Linux console
bindkey '\e[H' beginning-of-line # home
bindkey '\e[F' end-of-line # end
bindkey '\e[5~' delete-char # delete
bindkey '[D' emacs-backward-word # esc left
bindkey '[C' emacs-forward-word # esc right
;;
*rxvt*) # rxvt derivatives
bindkey '\e[3~' delete-char # delete
bindkey '\eOc' forward-word # ctrl right
bindkey '\eOd' backward-word # ctrl left
# workaround for screen + urxvt
bindkey '\e[7~' beginning-of-line # home
bindkey '\e[8~' end-of-line # end
bindkey '^[[1~' beginning-of-line # home
bindkey '^[[4~' end-of-line # end
;;
*xterm*) # xterm derivatives
bindkey '\e[H' beginning-of-line # home
bindkey '\e[F' end-of-line # end
bindkey '\e[3~' delete-char # delete
bindkey '\e[1;5C' forward-word # ctrl right
bindkey '\e[1;5D' backward-word # ctrl left
# workaround for screen + xterm
bindkey '\e[1~' beginning-of-line # home
bindkey '\e[4~' end-of-line # end
;;
screen)
bindkey '^[[1~' beginning-of-line # home
bindkey '^[[4~' end-of-line # end
bindkey '\e[3~' delete-char # delete
bindkey '\eOc' forward-word # ctrl right
bindkey '\eOd' backward-word # ctrl left
bindkey '^[[1;5C' forward-word # ctrl right
bindkey '^[[1;5D' backward-word # ctrl left
;;
esac
Unless you have changed these from default, the shell that you're using on Ubuntu is bash. On FreeBSD, the default shell is csh. You can change your shell with the following command in both OSs:
chsh
Set your shell in FreeBSD to /usr/local/bin/bash. Bash is not part of FreeBSD, so if you haven't already, install it from ports:
cd /usr/ports/shells/bash
make install
make clean
One last thing: don't change the shell for root. This is what the "toor" account is for: all the privileges of root, but you can set the shell to whatever you want. The reason being that there aren't any system activities that run under toor, so you won't break anything or confuse anyone by changing that account's shell to something you are used to (or may be more functional as a login shell).