Terminal – Replace Ctrl+r with Ctrl+k in Gnome Terminal


I'm using Ctrl+r for searching command history in the terminal but this keyboard shortcut is not comfortable for me.

I would prefer using Ctrl+k

How can I update this keyboard shortcut?

(Updating to Ctrl+k in addition to Ctrl+r is also an option)

Best Answer

You can use the shell builtin command "bind" for that. What you specifically want is:

bind '"\C-k":"\C-r"'

Put that in your ~/.bashrc file and it should work each time you open up a shell. For more details checkout the bind section here.

Related Question