2

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)

1

2 Answers 2

6

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.

1
  • And in ZSH it's: bindkey "^K" history-incremental-search-backward
    – Eyal Levin
    Feb 5, 2015 at 12:55
1

Check this stack overflow question about a similar problem.

But my advice is to keep Ctrl+k and Ctrl+r as is and get used to, because Ctrl+k is used to erase from the cursor to the end of the line which is a very useful shortcut.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .