My keyboard is configured such that Num Lock replaces certain alphabetical keys with numbers when Num Lock is on. There is also no Num Lock indicator light, which makes Num Lock cause confusion when entering passwords.

I have tried xmodmap -e 'keycode [Num Lock keycode] = NoSymbol Num_Lock', which works fine while in X11. However, it has no effect in tty.

Is there a way to prevent Num Lock from turning on that is system-wide?

  • 1
    Yes, see superuser.com/a/290149 for an example. I do the same to work around faulty keys. – dsstorefile1 Jul 26 '18 at 3:05
  • @dsstorefile1 Please add as an answer, that method worked nicely. I would prefer if there was a single global way to prevent Num Lock, but I haven't found one yet. – Digital Plane Jul 26 '18 at 4:19
  • This depends from your operating system. It's different answers for FreeBSD/TrueOS/DragonFly, NetBSD, and Linux operating systems. The consequent split between Debian/Ubuntu FreeBSD and Debian/Ubuntu Linux is further complicated by what Debian tries to do with keyboard configuration. – JdeBP Jul 26 '18 at 9:48

Create ~/.Xmodmap with the following:

! -*- coding: utf-8 -*-  
! 2014-10-04  
! make num lock do F18  
! keycode  77 = Num_Lock NoSymbol Num_Lock  

clear Lock

keycode 77 = F18 F18 F18

Run in terminal:

xmodmap ~/.Xmodmap
  • 2
    The questioner described in the question how to do this with X. The actual question was how do to this outwith X as well. – JdeBP Jul 26 '18 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.