Getting ;5D when hitting ctrl + arrow key in a Terminal on FreeBSD
Solution 1
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
Solution 2
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
Solution 3
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).
Related videos on Youtube
jdorfman
Updated on September 18, 2022Comments
-
jdorfman over 1 year
On centos I can skip a word by hitting ctrl + arrow (left or right) in a terminal. When I ssh into a FreeBSD box and I try the same pattern I get:
$ tail -f 20120412.log;5D;5D;5D
(each try = ;5D)
Is there a way to fix this? I am using Ubuntu 12.04 + Terminator.
Thanks in advance.
-
jdorfman about 12 yearsstill no love =|
-
omikron about 8 yearsTo clarify - this
.inputrc
should be set on remote machine. -
immeëmosol over 7 yearsworked for me, only after restarting byobu though.
-
AlbinoDrought about 5 yearsFor anyone that is entirely missing their
.inputrc
, the relevant lines for me were:"\e[1;5C": forward-word
,"\e[1;5D": backward-word
,"\e[5C": forward-word
,"\e[5D": backward-word
,"\e\e[C": forward-word
,"\e\e[D": backward-word
-
einpoklum over 4 yearsThis doesn't work for me.
-
alchemy about 4 years@immeëmosol, use
source ~/.bashrc ; exec bash
to restart in place. worked for me -
alchemy about 4 yearsFYI, it did cause other problems with pasting lines of code that had escape characters in it. It seems to be resolved now that the shell restarted ,so YMMV on my command above.
-
Alex Egli about 4 yearsThis is better written as a question ('what shell are you running?') rather than an answer.