How To Turn On Num Lock Automatically On Startup In Linux

turn on num lock in linux

One of the frustrating thing in most Linux distros is that the Num Lock is not enabled on startup. Whenever I start typing my password at system login screen, the focus goes out of the password field. It happens very often with people and this little problem is very irritating. But don’t worry. You can set your Linux to enable Num Lock automatically on startup.

How To Turn On Num Lock Automatically On Startup In Linux?

This little but irritating issue has been recently fixed in Linux Lite 3.0. Perhaps, they also realised how irritating it is to keep the Num Lock turn off on startup. Well, if you’re using any other distro such as Ubuntu or derivative then this article will fix the issue.

Install ‘numlockx’

We have a tiny tool available in the default Ubuntu repostiory that will help us out turning on Num Lock automatically on startup. I’ve not tested it in other than Ubuntu so I’m not sure at the moment the trick will work or not. I’ll soon test and will update the article.
sudo apt-get -y install numlockx
turn on num lock at startup in linux

  • Now paste the following script in the terminal. You’ll further see gedit window.
sudo gedit /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
num lock in linux numlockx

Now paste the following line in the configuration file and hit ctrl + s or save. Now exit the window. And that’s all.You’ve now configured the system to enable Num Lock automatically on startup. No more irritation. 🙂 As I mentioned I have only tested it working on Ubuntu though it should work on the other distros but I can only be sure after testing it myself.

Do let me know in the comments if it worked for you with other distros or not. If you have any problem then comment below the post in comment section, I’ll help you out.

Also share this article with your friends on social pages. Thank you!


MassiveGRID Banner
10 Comments Text
    • I would suggest installing this:

      sudo apt install numlockx -y

      Then put the following in your .zsh file:

      if [ -x /usr/bin/numlockx ]; then
      /usr/bin/numlockx on

      this doesn’t seem to work in lightdm at the moment, but it does work on the desktop.

  • I was unable to get this to work in Ubuntu 18.04.3 lts. I’m new at this and perhaps I was unable to correctly enter the text into gedit:

    greeter-setup-script=/usr/bin/numlockx on

    What I get in Terminal:

    ** (gedit:2305): WARNING **: 17:45:44.000: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported

    Yes, gedit is installed

  • I have Kubuntu 18.04.3 LTS which is a close relative of Ubuntu. Numlockx is not needed with the sddm in Kubuntu. There is a file sddm.conf in /usr/share/doc/sddm/. There’s different “stuff” in there, but for numlock look at the [General] section of sddm.conf.

    Copy the general section and past to a new document. Uncomment the Numlock line and change “auto” to “on” (no quotes) then save as /etc/sddm.conf using admin privileges. I used Kate as the text editor as it prompts for the sudo password.

    When you shutdown and boot again numlock should be on for password entry at the login screen. Your General section in the saved /etc/sddm.conf should like below. [If you already have an /etc/sddm.conf file just edit the General section for Numlock=on]

    # Halt command
    HaltCommand=/bin/systemctl poweroff
    # Input method module
    # Initial NumLock state. Can be on, off or none.
    # If property is set to none, numlock won’t be changed
    # NOTE: Currently ignored if autologin is enabled.
    # Numlock=none
    # Reboot command
    RebootCommand=/bin/systemctl reboot

  • Did not work on Ubuntu 19.10

    Numlockx installs without error. The 50-unity-greeter.conf is created and the text inserted.

    On boot, numlock is off.

  • Worked fine on new Raspbian Buster install on R Pi 4 (replacing gedit w/ mousepad in the command; did not use the [Seat]… whatever line…


  • For those having trouble getting this to work, you might want to check what filename the .conf file actually has. I’m running Xubuntu 20.04 and I had to use the path /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf instead of the one given in the article. I then edited the file leaving the first lines as follows

    greeter-setup-script=/usr/bin/numlockx on

  • Thank you for your helpful advice. It worked for me.
    May I offer one suggestion? When you write “Now paste the following line in the configuration file” could you then write those lines into your descriptive narrative? Like this:
    …Now paste the following line(s) in the configuration file…
    greeter-setup-script=/usr/bin/numlockx on

    As it is now, it’s impossible to do a copy/paste from your screen-shot.

  • Leave a Reply

    Your email address will not be published. Required fields are marked *