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)

2707974
  • 10,553
  • 6
  • 33
  • 45
Eyal Levin
  • 591
  • 7
  • 13

2 Answers2

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.

Charles Tassell
  • 331
  • 1
  • 4
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.

xoner
  • 126
  • 1
  • 6