As Thomas explained, you can add the bindings to /etc/inputrc
.
Another alternative so it loads every time you log in, is putting them in ~/.bashrc
like this:
#use ctl keys to move forward and back in words
bind '"\eOC":forward-word'
bind '"\eOD":backward-word'
I learned that you can use cat > /dev/null
to look at the characters that your keyboard is sending, e.g., CTRL + right arrow shows:
^[OC
where ^[
is the same as \e
so that's where the code comes from in the bind
command.
You can also look up bindings like this:
bind -p | grep forward-word
All of this is pretty damn awesome and I'm glad I found out some more power of bash.