rss feed Twitter Page Facebook Page Github Page Stack Over Flow Page

Enable numlock on Ubuntu

You like to use the num pad but unfortunately, it is not turned on? Here's a solution to turn on the numlock by default.

First of all, let's install the numlockx.

sudo apt-get install numlockx

Now, depending on which display manager you have, you will have to choose the solution that matches your manager.

cat /etc/X11/default-display-manager

lightdm

Edit the file /etc/lightdm/lightdm.conf and add the setup script to run the numlock when Ubuntu starts.

sudo vi /etc/lightdm/lightdm.conf

Add the following line at the end of the file:

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

gdm

Edit/Add the file /etc/gdm/Init/Default and add the setup script to run the numlock when Ubuntu starts.

sudo vi /etc/gdm/Init/Default

Add the following line at the end of the file before the line that says exit 0:

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

Global settings

Edit the file /etc/rc.local and add the setup script to run the numlock when Ubuntu starts.

sudo sed -i 's|^exit 0.*$|# Numlock enable\n[ -x /usr/bin/numlockx ] \&\& numlockx on\n\nexit 0|' /etc/rc.local