How to Enable / Disable Keyboard Number Pad on Startup in Ubuntu / Debian

For those using the keyboard number pad frequently, here’s how to enable or disable it automatically in GNOME desktop either in or after login.

Ubuntu used to disable the number pad by default in the login screen. Users have to hit the Numlock key every time to type a number in the password box. In the recent releases, it introduced “remember numlock state” function and enabled out-of-the-box.

It’s great that GNOME, the default desktop environment, remembers your numpad status even on next boot. However, user may sometimes turn the numlock off to use the keys for e.g., up/down arrow, page up/down and end, and want to set the number pad to always on or off on start up. Or some keyboards do not even have a numlock key, so to look for option to toggle the keyboard function.

For all these cases, this tutorial may help! And it’s tested and works on Ubuntu and Debian, and should work on other Linux based on Gnome, e.g., Fedora, Manjaro, CentOS.

Automatic Enable / Disable Number Pad after login:

GNOME has the hidden option to toggle the settings that System Settings and Gnome Tweaks do not include. You can configure it either by running one or two commands in terminal or using the graphical Dconf Editor tool.

Option 1.) Toggle number pad status via Linux command:

Firstly, press the Windows (Super or mac command) key on keyboard, or click the top-left ‘Activities’ button to bring up overview screen. Then search for and open terminal.

When terminal opens, copy and paste the command below into it and hit Enter to disable ‘remember numlock state’ feature:

gsettings set org.gnome.desktop.peripherals.keyboard remember-numlock-state false

Then set GNOME to automatic enable (or disable by set to “false”) number pad on login by running command:

gsettings set org.gnome.desktop.peripherals.keyboard numlock-state true

After that, numpad should be on or off (depends on true or false you set in last command) automatically after logging into GNOME in next boot.

(Optional) To restore changes, simply reset the key via a single command:

gsettings reset org.gnome.desktop.peripherals.keyboard remember-numlock-state

Option 2.) Configure number pad status via Dconf Editor:

For those hate Linux command, search for and install dconf editor tool from Ubuntu Software (or Gnome Software) app:

Next open the tool and navigate to “/org/gnome/desktop/peripherals/keyboard“. In that page, toggle the slider icons of ‘remember-numlock-state’ and ‘numlock-state’ to meet you need.

Automatic Enable or Disable Number Pad in GNOME Login Screen:

The numpad may be used sometimes for typing password in the login screen. Though the default remember numlock status function is great for this case, user can still set it to on/off automatically.

Since the login screen is handled by GNOME Display Manager, the previous step will not work here due to permission issue.

1. Find out the user for GNOME Display Manager:

Usually, you need gdm user permission to do the configuration for login screen. However, the username varies on some Linux Distributions, such as Debian 11 uses Debian-gdm to handle login screen.

So firstly search for and open terminal from the overview screen. Then run command to check it out:

cat /etc/passwd |grep "Gnome Display Manager"

For Ubuntu it’s “gdm” and for Debian 11 it’s “Debian-gdm”, here’s the output in Ubuntu terminal (take the first word: gdm):

gdm:x:122:127:Gnome Display Manager:/var/lib/gdm3:/bin/false

2. Set Numlock status in Login Screen:

Next also in a terminal window, copy and paste the command below and run one by one.

a.) Firstly, add gdm user to the control list (replace gdm to what you get in previous step):

xhost SI:localuser:gdm

b.) Next run command to disable “remember-numlock-state” function:

sudo -u gdm gsettings set org.gnome.desktop.peripherals.keyboard remember-numlock-state false

c.) Finally set to automatic enable (true)/ disable (false) numlock:

sudo -u gdm gsettings set org.gnome.desktop.peripherals.keyboard numlock-state true

NOTE in previous command replace gdm with the user your got in step 1. And for Manjaro Gnome, you need to add “dbus-launch” between gdm and gsettings in the command. So the commands will be:

sudo -u gdm dbus-launch gsettings set PATH/TO/KEY VALUE

Replace PATH/TO/KEY and VALUE in the code and Enjoy!

Merilyn Ne
Hi, I'm Merilyn Ne, a geek who has been working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.