To permanently remove a bash key binding, you'll want to modify your ~/.inputrc file (for readline configurations) or your ~/.bashrc file. Here's how to do it:
Option 1: Using ~/.inputrc (Recommended)
The ~/.inputrc file controls readline bindings for all programs that use readline, including bash.
Create or edit your ~/.inputrc file:
bash
nano ~/.inputrc
Add the following line to unbind Ctrl-X 1:
code
"\C-x1": ""
If you want to unbind the entire Ctrl-X prefix (which might affect other Emacs-like bindings in bash), you could use:
code
"\C-x": ""
But this is more aggressive and might disable other useful shortcuts.
Save the file and exit (Ctrl+O, Enter, Ctrl+X in nano)
For the changes to take effect, either:
Start a new terminal session
Or run bind -f ~/.inputrc in your current session
Option 2: Using ~/.bashrc
If you prefer to keep the configuration in your bash profile:
Edit your ~/.bashrc file:
bash
nano ~/.bashrc
Add the following line at the end:
bash
bind '"\C-x1":""'
Save the file and exit
For the changes to take effect:
Start a new terminal session
Or run source ~/.bashrc in your current session
Finding and Removing Specific Bindings
If you want to see what specific binding is causing the issue before removing it:
Run this command to see all Ctrl-X related bindings:
bash
bind -p | grep -i "\\C-x"
Look for any binding that includes \C-x1
Once you identify the specific binding, you can unbind just that one in your ~/.inputrc or ~/.bashrc
Testing the Change
After making the change, you can verify it worked by:
Starting a new Konsole session
Running Emacs
Trying the Ctrl-X 1 key sequence to see if it now properly triggers the Emacs command
The ~/.inputrc approach is generally preferred because it applies system-wide to all programs that use readline, not just bash, and it's the standard place for these configurations.