I suspect this can't be done, but I would like to disable a specific key (namely '6' on the top row) on a specific keyboard (namely my laptop internal keyboard). The key is spamming 6s but is otherwise working (and I've ordered a replacement but it will take a long time due to location). I am mostly using a USB keyboard but it is a pain to disable an entire keyboard (using xinput --float) just for one key.

So: is it possible to disable a specific key on a specific keyboard? I am using Kubuntu 19.10 although I suspect that is not important for this.


1 Answer 1


I would try this:

Use xev to find the keycode of the 6 key on your keyboard, "on mine it is 15". Then use xmodmap -e "keycode 15 = " where 15 is the number you found with xev. This will map that key to nothing. If that ends up not being persistent after reboot add that command to your startup apps.

If wanting for just one keyboard:

Install xkbcomp > 1.2.0

Use xinput list find the specific keyboard id

Find the keycode for the key xev

FURTHER instructions at the link... https://superuser.com/a/869064/964775

  • I ended up doing it a slightly different way as this method didn't work for some reason, but got me on the right track :) Did something like: miek.nl/2014/october/28/xmodmap-is-dead but using the -i (remote_id) flag. Feb 8, 2020 at 15:47
  • It would be good to add a way to undo the change. Aug 20 at 9:05
  • I have the issue with spamming <. It seems to be keycode 94. Interestingly, xmodmap -e "keycode 94 = " seems not to have any effect (Ubuntu 20.04, Thinkpad T460p) Aug 20 at 9:06
  • It seems to work only for the current terminal. I also tried xmodmap -e 'keycode 94=NoSymbol' Aug 20 at 9:28

You must log in to answer this question.

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